Page 1 of 1

Inheritance and over-riding...

Posted: Wed Jan 21, 2004 1:15 am
by LonelyProgrammer
Which output function will be called in the case of the code below?

Code: Select all

class A
{
   A() { }

   greet() { echo "Greetings from A!"; }

   output() { $this->greet(); }

}

class B extends A
{
  B() { parent::A(); }

  greet() { echo "Greetings from B!"; }

  output() { parent::output(); }
}

Re: Inheritance and over-riding...

Posted: Wed Jan 21, 2004 2:01 am
by McGruff
The child. Full explanation in the manual.

Posted: Wed Jan 21, 2004 2:07 am
by LonelyProgrammer
Thanks!