note 31476 deleted from language.oop by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 16:34:06 +0000 |
| Subject: | note 31476 deleted from language.oop by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57753@lists.php.net to get a copy of this message | ||
Note Submitter: yaroukh@email.cz
----
to Mad Murdock:
@ 06-Mar-2003 08:34 you wrote:
"this line is not needed as the ParentObject funtion is a constructor for ParentObject class,
which MemberObject is extending. Thus, it inherits it and since it is a constructor, it is executed
automatically."
I think you're wrong. A constructor of the "parent" class is being called only if the
"child" class constructor is not found.
Following example prooves this - the Parent's constructor is not being executed and the output
is only: "here I am - Child constructor"
<?..class Parent {
........function Parent() {
............print "here I am - Parent constructor";
........}
....}
....class Child extends Parent {
........function Child() {
............print "here I am - Child constructor";
........}
....}
....$child =& new Child();
?>
Have a nice day
Yaroukh