老師講的不錯(cuò),一直不太明白的對(duì)象引用,通過(guò)老師本節(jié)課讓我醍醐灌頂。
2018-02-02
function checkEat($obj){
if($obj instanceof ICanEat){
$obj->eat('food');
}else{
echo "The obj can't eat.\n";
}
}
if($obj instanceof ICanEat){
$obj->eat('food');
}else{
echo "The obj can't eat.\n";
}
}
2018-01-28
最贊回答 / 蒙牛轉(zhuǎn)轉(zhuǎn)
肯定有啊
Nbaplaye$jordan = new Nbaplayer();中的Nbaplayer()跟上面的class Nbaplayer()有關(guān)系嗎
2018-01-25
最新回答 / qq_啾皮卡丘_0
只要你創(chuàng)建了對(duì)象就會(huì)調(diào)用構(gòu)造函數(shù) 包括你傳參數(shù)時(shí) 參數(shù)為對(duì)象也會(huì)調(diào)用,當(dāng)程序運(yùn)行遇到大括號(hào)時(shí)就會(huì)隱式調(diào)用析構(gòu)函數(shù) 并不一定兩者次數(shù)會(huì)一樣
2018-01-22