RE: [PHP-DEV] Overloading object methods
| From: | John Coggeshall | Date: | Thu, 09 Jan 2003 09:40:42 +0000 |
| Subject: | RE: [PHP-DEV] Overloading object methods | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93282@lists.php.net to get a copy of this message | ||
This list is for the development _of_ PHP not _with_ PHP, please direct
future questions there....
However, I don't understand the question you are asking... If you have
this:
Class A {
function foo() {
echo "I am function foo<BR>";
}
}
Class B extends A {
function foo() {
echo "I am the child function foo<BR>";
parent::foo();
}
}
$a = new B;
$a->foo();
It will output:
I am the child function foo
I am function foo
http://www.php.net/manual/en/keyword.parent.php
John
>-----Original Message-----
>From: Stefano Corsi [mailto:scorsi@madeinlinux.com]
>Sent: Thursday, January 09, 2003 5:28 AM
>To: php-dev@lists.php.net
>Subject: [PHP-DEV] Overloading object methods
>
>
>Does someone know how to call a parent's object method? Not contructor
>(because that is easy) but a method with the same name.
>
>For example, if I have a method that is called pippo() and at
>the end of the
>method i want to call parent::pippo(), how could I do?
>
>I tried with call_user_function using
>
>&(this_object->ce->parent->function_table)
>
>as the function table, but I don't know how to pass the
>underlyig object.
>
>Thanks,
> Stefano
>
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>