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();
?>

输出结果:

喜欢吃粤菜
喜欢喝汤

 

猜你喜欢

转载自www.cnblogs.com/saintdingspage/p/10963948.html