|
Posted by Andy Jeffries on 05/03/06 15:06
OK, assuming the following class structure:
class A {
public function printConst()
{
print {something}::TEST_CONST;
}
}
class B extends A {
const TEST_CONST = 10;
}
class C extends A {
const TEST_CONST = 20;
}
So, I want to be able to do as follows:
$b = new B();
$b->printConst();
$c = new C();
$c->printConst();
What I want to know is what should go instead of {something}. I don't
want the class it's declared in, but the class it's being called from.
I'm sure there's a way to do it, I remember reading it when studying for
the ZCE, but I'm damned if I can find it now when I need it.
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
[Back to original message]
|