This is a discussion on RE: [PHP] Question regarding OOP and interitance within the PHP General forums, part of the PHP Programming Forums category; [snip] > FYI ... anything below PHP5 has a pseudo constructor. And how will it be in PHP5 ? [/snip] PHP5 will ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
[snip]
> FYI ... anything below PHP5 has a pseudo constructor. And how will it be in PHP5 ? [/snip] PHP5 will be using the Zend 2 Engine, and gives a standard way of declaring constructor methods by calling them by the name __construct(). An example from http://www.php.net/zend-engine-2.php <?php class BaseClass { function __construct() { print "In BaseClass constructor\n"; } } class SubClass extends BaseClass { function __construct() { parent::__construct(); print "In SubClass constructor\n"; } } $obj = new BaseClass(); $obj = new SubClass(); ?> True destructors will also be available, as should be true private methods. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|