PHP多个接口同个方法的问题
时间:2010-11-06 来源:liushan
如下实例:
interface a{
public function x();
}
interface b{
public function x();
}
class c implements a,b{
public function x();
}
报如下错误: Can't inherit abstract function b::x() (previously declared abstract in c)
如果要实现不同接口有相同的方法,可以如下实现:
interface d{
public function x();
}
interface a extends d{}
interface b extends d{}
class c implements a,b{
public function x(){
echo "succ";
}
}
相关阅读 更多 +