PHP编程类的问题
<?phpclass Tanks
{
var $name;
private $age;
var $tel;
function __construct($name="尚未填写",$age="尚未填写",$tel="尚未填写"){
$this->name=$name;
$this->age=$age;
$this->tel=$tel;
}
function text(){
echo "名字".$this->name.".年龄:".$this->age.".电话:".$this->tel;
}
function getage($age){
if($age>0||$age>150) //此处判断大于零 且小于150为什么不起作用,哪位大侠解释下
return;
$this->age=$age;
}
function __destruct(){
echo $this->name."再见";
}
}
$p1=new tanks("王五","200","15919608650");
$p1->text();
$p1=new tanks("李四","15","15919608650");
$p1->text();
?>