【发布时间】:2019-02-02 15:12:52
【问题描述】:
class FatherClass
{
private $salary = 10;
public function showInfo()
{
echo $this->phone . '<br/>';
// why this result is 10
// why the result is not 20000
echo $this->salary . '<br/>';
}
}
class ChildClass extends FatherClass
{
protected $phone = '13987654321';
private $salary = 20000;
}
$child = new ChildClass();
$child->showInfo();
echo '<pre>';
print_r($child);
“私人”的问题:
为什么这个结果是 10
为什么结果不是 20000
感谢您的帮助
【问题讨论】: