Cannot implement two interfaces that have the same method name

后端 未结 5 2020
[愿得一人]
[愿得一人] 2021-01-13 07:28

This doesn\'t work:

interface TestInterface
{
    public function testMethod();
}

interface TestInterface2
{
    public function testMethod();
}

class Test         


        
5条回答
  •  猫巷女王i
    2021-01-13 08:06

    interface BaseInterface
    {
        public function testMethod();
    }
    
    interface TestInterface extends BaseInterface
    {
    }
    
    interface TestInterface2 extends BaseInterface
    {
    }
    
    class TestClass implements TestInterface, TestInterface2
    {
        public function testMethod()
        {
        }
    }
    

提交回复
热议问题