Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:恭喜你,入门了
class A{
public $name;
public $age;
// 构造方法有什么用,可以接受传值,在实例化时就传值
public function __construct($name,$age){
// 在类里面如何访问类成员?用$this->
$this -> name=$name;
$this -> age=$age;
echo $this -> name.$this -> age;
}
}
$a= new A('猴子','3岁');
echo '<hr>';
$a= new A('兔子','1岁');