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();
?>
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »