📅  最后修改于: 2020-10-10 00:46:15             🧑  作者: Mango
name=$n;
$this->age=$a;
}
public function setAge($ag)
{
$this->ag=$ag;
}
public function display()
{
echo "welcome ".$this->name."
";
return $this->age-$this->ag;
}
}
$person=new person("sonoo",28);
$person->setAge(1);
echo "You are ".$person->display()." years old";
?>
输出: