Log in

View Full Version : PHP5 Screwy Inherritance


Ademan
Jan 16, 2006, 10:38 PM
Ok, I have this lovely situation, lets say I have 3 classes, A, B, and C.
C derives from B which derives from A (extends).
A defines the member function foo.
B doesn't do anything regarding foo.
C wants to redefine foo.

QUESTION: does ignoring an inherrited member function mark it implicitly as final?

Here's "sample" code

Class A
{
Function foo()
{
//some function body
}
}

Class B extends A
{
//anything not regarding foo
}

Class C extends B
{
Function foo()
{
//redefined body
}
}

The problem is when I try and call foo from a class C, I get an error (it looks like $this is not defined)

Thanks a lot
-Dan

Ademan
Jan 19, 2006, 10:33 PM
Well, as it turns out the problem was elsewhere, meh. The example I have is perfectly valid.

Cheers
-Dan