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

热门标签

php 实现 接口 继承
<?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();
?>

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!

评论 (0)