<?php
class Person{
private $name;
private $age;
public function __construct($name,$age){
$this->name = $name;
$this->age = $age;
}
public function show(){
echo $this->name."||".$this->age;
}
}
class Child extends Person{
}
$child = new Child("aaa",5);
$child->show();
?>
为什么会打印出 aaa||5
子类不是应该继承了父类的show()方法,然后父类方法中的$this不是应该指的是子类的对象实例吗
但是子类继承的时候应该没有继承到父类的private成员属性
所以为什么能打印出东西???