note 61286 deleted from language.oop5.decon by levim
| From: | levim@php.net | Date: | Tue, 18 Mar 2014 02:10:47 +0000 |
| Subject: | note 61286 deleted from language.oop5.decon by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198922@lists.php.net to get a copy of this message | ||
Note Submitter: jochem AT mondrian-it d_o_t nl
----
at: derk AT oneindig DOT com
You can achieve identical functionality by doing this:
<?php
class Parent {
function __construct()
{
echo "Parent constructor called\\n";
}
}
class Child extends Parent {
function __construct()
{
parent::__construct();
echo " Child 'contructor' called";
}
}
$c = new Child();
?>
Added advantage is that Parent doesn't need to have the method myConstruct(), and that
you're using constructors like they were intended.