php class knowledge --- Interface



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

Output:

I like to eat Cantonese
like soup

 

 

Guess you like

Origin www.cnblogs.com/saintdingspage/p/10963948.html