Calling a derived static method from a method in parent class in PHP
This question already has an answer here:
You use late static binding for this
Basically in the abstract class you call static::method()
. This uses the method of the class that made the call.
Abstract Class A{
public function foo(){
// Late static binding
static::bar();
}
abstract public static function bar();
}
链接地址: http://www.djcxy.com/p/58030.html
上一篇: 函数重写需要实例吗?