note 109562 rejected from keyword.parent by danbrown
| From: | danbrown@php.net | Date: | Mon, 30 Jul 2012 15:48:12 +0000 |
| Subject: | note 109562 rejected from keyword.parent by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189477@lists.php.net to get a copy of this message | ||
Note Submitter: amitdeopanwar at yahoo dot com
----
Is there anyway to reference parent's parent function?
for example:
class A
{
function test()
{
echo "A->test() called";
}
}
class B extends A
{
function test()
{
echo "B->test() called";
}
}
class C extends B
{
function test()
{
parent::test();
}
}
$obj=new C();
$obj->test(); //outputs B->test() called
What should i write in C::test() function so that it executes parent's parent::test() ie. the
output of $obj->test() is A->test() called.