Re: Inheritance-problem

From: Date: Wed, 09 Aug 2000 11:50:50 +0000
Subject: Re: Inheritance-problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10898@lists.php.net to get a copy of this message
Martin wrote:
Hello ! Using PHP3, I have 2 classes: class A
{    function DoSomething();
} class B extends A
{    function DoSomething();
} In B::DoSomething(), I want to call A::DoSomething() (that means the same member, but in the base-class). How is it done ?
Maybe I'm missing something, but is this what you want? <? class A { function DoSomething() {
    return 'Foo';
} } class B extends A { function DoAnotherThing() {
    print $this->DoSomething();
} } $test = new B; $test->DoAnotherThing(); ?> Or maybe something else?: <? class A { function DoSomething() {
    return 2 + 2;
} } class B extends A { function B() {
    print $this->DoSomething();
} } $test = new B; ?> That what you wanted?

« previous php.general (#10898) next »