pay.php
复制代码 代码如下:
interface ipay
{
function withmoney();
//function withinternet();
}
class dmeng implements ipay
{
function withmoney()
{
echo "花人民币买东西";
}
function withinternet()
{
return "用网银支付";
}
}
usei.php
复制代码 代码如下:
include_once 'pay.php';
class main
{
function run($vc)
{
$this->vc = $vc;
$this->vc->withinternet();
echo "yunxing";
}
}
$com= new main();
$com->run(new dmeng);
就是上面那样,我们将interface中的某个方法注释掉,发现再调用的时候,就没用了
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!