为什么下面的代码不返回值?我只是空白屏幕。oops私有变量值不会返回错误
至少它应该返回一些错误,当我尝试在子类中的私有变量val。
class Customer {
private $instance_count = 0; //private data member
function sub1(){
return $this->instance_count++;
}
}
class CustomerChild extends Customer{
function sub2(){
return $this->instance_count++;
}
}
$CustomerObj = new CustomerChild();
print $CustomerObj->sub2();
但当我使用未定义的变量时,并且当我访问子类中的私有方法时出现错误。 – user1127564 2012-04-20 09:03:37