爲什麼下面的代碼不返回值?我只是空白屏幕。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