php类知识---接口



<?php

interface wenwa
{
function eat();
}
interface duwa
{
function drink();
}
class cpc implements duwa,wenwa
{
public function eat()
{
echo "喜欢吃粤菜"."\n";
}
public function drink()
{
echo "喜欢喝汤"."\n";
}
}
$cpc = new cpc();
$cpc->eat();
$cpc->drink();
?>

输出结果:

喜欢吃粤菜
喜欢喝汤

 

 

posted @ 2019-06-02 19:11  saintdingtheGreat  阅读(98)  评论(0编辑  收藏  举报