Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
<?php
class people {
public $name;// 姓名
public $gender; //性别
protected $age; //年龄
private $birthday; //生日
public function __construct($name,$gender,$age,$birthday)
{
$this->name = $name;
$this->gender = $gender;
$this->age = $age;
$this->birthday = $birthday;
}
public function say()
{
return "大家好我是{$this->name},我是一个{$this->gender}孩 <br>";
}
public function speak(){
return "我今年{$this->age}岁 我的生日是{$this->birthday}";
}
}
$obj = new people('小明','男',13,'2008.05.06');
echo $obj->say();
echo $obj->speak();
$obj->name='小红';
$obj->gender ='女';
echo $obj->say();
echo $obj->speak();