Sunday, April 7, 2013

What is __construct?

void __construct

PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.

Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call toparent::__construct() within the child constructor is required. If the child does not define a constructor then it may be inherited from the parent class just like a normal class method (if it was not declared as private).

read more

0 comments:

Post a Comment