首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

希望指点错在哪里,应该要如何样改

2012-04-12 
希望指点错在哪里,应该要怎么样改??phpinterface PCI{function ShowDiveceName()}class SoundAdaper imp

希望指点错在哪里,应该要怎么样改?
<?php
interface PCI{
function ShowDiveceName();
}
class SoundAdaper implements PCI{
function ShowDiveceName(){
echo "SoundAdaper<br>";
}
}
class NetworkAdaper implements PCI{
function ShowDiveceName(){
echo"NetworkAdaper<br>";
}
}
class DisplayAdaper implements PCI{
function ShowDiveceName(){
echo"DisplayAdaper<br>";
}
}
class Mainboard{
private $PciDevice;
function plug($PciDevice){
$this->PciDevice=$PciDevice;
}
function PCI(){
$this->PciDevice->ShowDeviceName();
}
}
class Engineer{
function Work($Main,$PciDevice){
$Main->plug($PciDevice);
//Fatal error: Call to a member function plug() on a non-object in C:\wamp\www\class_class.php on line 39
//不太明白$Main->plug($PciDevice);这错在哪里
}
}

$sound = new SoundAdaper();
$video = new DisplayAdaper();
$net = new NetworkAdaper();
$main = new MainBoard();
$people = new Engineer();
$people->Work($Main,$SoundAdaper);
$main->PCI();
$people->Work($Main,$DisplayAdaper);
$main->PCI();
$people->Work($Main,$NetworkAdaper);
$main->PCI();
?>

[解决办法]
另外 $SoundAdaper、$DisplayAdaper、$NetworkAdaper 在哪里赋值的?

热点排行