abstract:类和对象的定义,类中成员属性和常量的使用,类的自动加载机制,类的封装机制。<?phpclass Sport{ public $name; public $height; public $age; public $sex; public function __con
类和对象的定义,类中成员属性和常量的使用,类的自动加载机制,类的封装机制。
<?php
class Sport{
public $name;
public $height;
public $age;
public $sex;
public function __construct($name,$height,$age,$sex)
{
$this->name=$name;
$this->height=$height;
$this->age=$age;
$sex->sex=$sex;
}
public function basketBall(){
if($this->height>'190'){
return $this->name."符合打篮球要求";
}else{
return $this->name."不符合打篮球要求";
}
}
}
$sport=new Sport("姚明",'220',"30","男");
$sport->basketBall();
?>
Correcting teacher:天蓬老师Correction time:2018-12-20 17:27:59
Teacher's summary:没看到你的封装呀, 封装是不允许使用public的