PHP类、接口的继承以及接口的实现

2018-04-20T22:25:00
<?php
interface usb{
    public function star();
    public function stop();
  }

  interface sb{
    public function action();
  }

  //接口的继承
  interface all extends usb,sb{

  }


  class parente{
    public function test(){}
  }

  //类的继承以及接口实现
  class phone extends parente implements all{
    public function star(){
        echo "phone began to work<br>";
    }

    public function stop(){
        echo "phone stop to work<br>";
    }

    public function action(){
        echo "much interface<br>";
    }

    public function test(){
        echo "come form parents<br>";
    }
  }

 $huawei = new phone();
 $huawei->star();
 $huawei->stop();
 $huawei->action();
 $huawei->test();
?>
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »