/*
    * 使用多接口
    */

    //定义接口1
    interface IPerosn_one{
        public function eat();
    }

    //定义接口2
    interface IPerson_two{
        public function run();
    }

    //定义接口3
    interface IPerson_three{
        public function water();
    }

    //定义继承自接口的类
    class Menperson implements IPerosn_one,IPerson_two,IPerson_three{
        function eat(){
            echo '吃饭!';
        }
        
        function run(){
            echo '奔跑!';
        }

        function water(){
            echo '喝水!';
        }
    }


    //实例化一个继承了多接口的类
    $menp = new Menperson();
    $menp->eat();
    $menp->run();
    $menp->water();

 

相关文章:

  • 2021-10-13
  • 2021-10-20
  • 2021-12-13
  • 2021-12-13
  • 2021-11-11
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-01-01
  • 2021-10-09
  • 2021-09-01
相关资源
相似解决方案