RE: [PHP] Question regarding OOP and interitance
| From: | Jay Blanchard | Date: | Thu, 04 Sep 2003 17:09:57 +0000 |
| Subject: | RE: [PHP] Question regarding OOP and interitance | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161678@lists.php.net to get a copy of this message | ||
[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.