note 17494 modified in keyword.extends by vincent

From: Date: Mon, 11 Aug 2003 15:34:16 +0000
Subject: note 17494 modified in keyword.extends by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53887@lists.php.net to get a copy of this message
if the class B that extends class A does not have a constuctor function (i.e. a function named B), then the constructor function of A will be used instead, you don't need to make a constructor in B just to call the constructor of A. For example: class A { function A() { echo "HEY! I'm A!\n"; } } class B extends A { } $b = new B(); produces the output: HEY! I'm A! --was-- To Clarify the above statement, if the class B that extends class A does not have a constuctor function (i.e. a function named B), then the constructor function of A will be used instead, you don't need to make a constructor in B just to call the constructor of A. For example: class A { function A() { echo "HEY! I'm A!\n"; } } class B extends A { } $b = new B(); produces the output: HEY! I'm A! http://www.php.net/manual/en/keyword.extends.php

« previous php.notes (#53887) next »