class A{
private static $instance;
public static function getInstance(){
if(!(self::$instance instanceof self))
self::$instance = new self();
return self::$instance;
}
public function doStuff(){
echo 'stuff';
}
}
class B extends A{
public function doStuff(){
echo 'other stuff';
}
}
A::getInstance()->doStuff(); // prints "stuff"
B::getInstance()->doStuff(); // prints "stuff" instead of 'other stuff';
我在做什麼錯?在PHP中擴展一個類
爲什麼B類不運行它的功能?