note 51123 added to language.oop5
| From: | spam at afoyi dot com | Date: | Mon, 21 Mar 2005 01:18:54 +0000 |
| Subject: | note 51123 added to language.oop5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86727@lists.php.net to get a copy of this message | ||
You can call a function defined in an inherited class from the parent class. This works in both PHP
4.3.6 and 5.0.0:
<?php
class p {
function p() {
print "Parent's constructor\n";
}
function p_test() {
print "p_test()\n";
$this->c_test();
}
}
class c extends p {
function c() {
print "Child's constructor\n";
parent::p();
}
function c_test() {
print "c_test()\n";
}
}
$obj = new c;
$obj->p_test();
?>
Outputs:
Child's constructor
Parent's constructor
p_test()
c_test()
----
Manual Page -- http://www.php.net/manual/en/language.oop5.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51123
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51123&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51123&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51123&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51123&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51123&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51123&report=yes
Search -- http://master.php.net/manage/user-notes.php