note 8332 modified in Classes and Objects by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Wed, 06 Sep 2000 23:47:55 +0000 |
| Subject: | note 8332 modified in Classes and Objects by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4277@lists.php.net to get a copy of this message | ||
[Editor's note: This comment is notcorrect for PHP4, there is a way of calling the parent
method, by using the "parent::method()" syntaxis, e.g:
class a {
function init() {
echo "FOO";
}
}
class b extends a {
function init() {
a::init();
echo " and BAR";
}
}
$o = new b;
$o->init();
Which will print: "FOO and BAR"]
Actually the comment left by darkarena@idcomm.com is correct. cleong@organic.com is mistaken.
You CANNOT call an overloaded parent function without trickery.
For example:
class a
{
function init(){}
}
class b extends a
{
function init(){}
}
How would you call a->init() from b ?
http://www.php.net/manual/classes-and-objects.php