|
Posted by Kjell Bublitz on 01/26/07 06:25
Hi all
I have a little problem. The method __toString() inherits as expected
on all sub-classes but the __CLASS__ constant returns only the name of
the parent class where the method is defined.
class Base {
public function __toString()
{
return 'Type: '.__CLASS__.', Class: '.$this->name.' (Level:
'.$this->level.')';
}
}
class SubClass extends Base
{
// something
}
$obj = new SubClass();
echo $obj; // -> displays "Base"
Is there a way to get around this?
TIA, Kjell
Navigation:
[Reply to this message]
|