:::

24. Class/*Objects*/

The basic class syntax looks like the following:

class Classname {

}

The class keyword means that you create a new class; the syntax is quite similar to the function syntax.

And you can create new instances of this class using the following syntax:

$obj1 = new Classname();

The new keyword means that you create a new object and ensures that your arguments are added as properties, so it initializes theconstructor (which we are going to deal with later).

We don't need to pass in any arguments, as we haven't added any properties (which can store different values depending on the instance) quite yet.


:::

語系選擇