1.子类无法访问父类private 属性和方法
2.不支持方法的重载
<?php
class _Parent{
private $data = "parent";
protected $data2 = "protected data";
public function _print()
{
echo $this->data . "<br>";
}
}
class childA extends _Parent{
}
class childB extends _Parent{
protected $data = "childB";
public function _print()
{
echo $this->data . "<br>";
}
}
class childC extends _Parent{
public function other(){
echo $this->data2;
}
public function _print($d)
{
echo $this->data2 . $d;
}
}
$A = new childA();
$B = new childB();
$C = new childC();
$A->_print();
$B->_print();
$C->other();
$C->_print(",hi");
?>