【发布时间】:2011-06-29 13:23:21
【问题描述】:
<?php
class MyParent {
public static function tellSomething() {
return __CLASS__;
}
}
class MyChild extends MyParent {
}
echo MyChild::tellSomething();
上面的代码回显“MyParent”。我怎样才能得到子类的名字——在这种情况下是“MyChild”?如果可以的话……
我只需要知道哪个孩子正在调用继承的方法。
【问题讨论】:
标签: php oop inheritance