note 17494 modified in keyword.extends by irc-html

From: Date: Sat, 19 Jan 2002 19:46:03 +0000
Subject: note 17494 modified in keyword.extends by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25281@lists.php.net to get a copy of this message
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! --was-- To Clarify the above statement,<B> 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. <p> For example:<BR> class A<BR> { <Br> function A() { <br> echo "HEY! I'm A!\n"; <BR> } <BR>} <BR>class B extends A { <BR>} <BR> <BR>$b = new B(); <p> produces the output: <Br>HEY! I'm A! http://www.php.net/manual/en/keyword.extends.php

« previous php.notes (#25281) next »