{if($this->getHdSize()<1024){echo "硬盘太小";return false;}return true;}为什么换成$hd=5000;之后,还是会返回“硬盘太小”呢?
{if($this->getHdSize()<1024){echo "硬盘太小";return false;}return true;}
{if($this->getHdSize()<1024){echo "硬盘太小";return false;}return true;}
2018-04-26
<?php
class Computer{
public $cpu ="amd";
public $mainboard="华硕";
private $hd=5000;
public function game($gameName=''){
if($this->getHdSize() <1024){
echo "硬盘太小";
return false;
}return true;
}
public function job($work="工作"){
echo ($this->game());
}
private function getHdSize(){
return $this->hd;
}
}
$computer=new Computer();
$computer->job();
举报