PHP多继承的简单写法

PHP多继承的简单写法
采用的是interface 然而继承没用extend
<pre>
<?php
interface father{
function shuchu();
}
interface mother{
function dayin($my);
}
interface fam extends father,mother{
function cook($name);
}
class test implements fam{
function dayin($my){
echo "我的名字是:".$my;
echo "<br>";
}
function shuchu(){
echo "接口继承,要实现两个抽象方法";
echo "<br>";
}
function cook($name){
echo "平时经常做饭的人是:".$name;
}
}
$t=new test();
$t->shuchu();
$t->dayin("小强");
$t->cook("妈妈");
?>
</pre>

posted @ 2019-11-12 14:43  newmiracle宇宙  阅读(107)  评论(0编辑  收藏  举报