📜  php 从抽象类内部调用抽象静态函数 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:45.984000             🧑  作者: Mango

代码示例1
abstract class AbstractFoo{
    public static function foo() {
        throw new RuntimeException("Unimplemented");
    }
    public static function getFoo(){
        return static::foo();
    }
}

class ConcreteFoo extends AbstractFoo{
    public static function foo(){
        return "bar";
    }
}

echo ConcreteFoo::getFoo();