Re: simple class & constructor
| From: | David Harkness | Date: | Wed, 20 Oct 2010 00:41:34 +0000 |
| Subject: | Re: simple class & constructor | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308867@lists.php.net to get a copy of this message | ||
The "constructor" is the __construct() method, and it gets executed
automatically when you instantiate the class into an object. The class
defines the state (fields/properties) and behavior (methods/functions) that
its objects will have. Instantiating the class is the fancy term for
creating a new object with that state and behavior and calling the class's
constructor on it. From then on you can call other methods on the object and
access its public state.
David