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

输出结果:

喜欢吃粤菜
喜欢喝汤

 

 

相关文章:

  • 2021-12-09
  • 2021-12-02
  • 2021-11-18
  • 2021-09-25
  • 2021-09-03
  • 2022-01-10
  • 2021-07-02
猜你喜欢
  • 2021-11-30
  • 2021-12-05
  • 2021-07-13
  • 2021-10-19
  • 2021-04-12
  • 2021-09-05
  • 2021-08-19
相关资源
相似解决方案