【发布时间】:2011-07-26 17:43:54
【问题描述】:
这不起作用:
interface TestInterface
{
public function testMethod();
}
interface TestInterface2
{
public function testMethod();
}
class TestClass implements TestInterface, TestInterface2
{
}
给我错误:
致命错误:无法继承抽象函数 TestInterface2::testMethod()(之前在 TestInterface 中声明了抽象)。
正确吗?为什么不允许这样做?对我来说没有意义。
抽象函数也会发生这种情况,例如,如果您实现了一个接口,然后从具有同名抽象函数的类继承。
【问题讨论】: