class A{
<code> public $age = 50; private $money = 2000; static public $head = 1; public function tell(){ echo $this->age,'<br>'; echo self::$head,'<br>'; } static public function sayMoney(){ echo $this->money,'<br>'; }</code>
}
class B extends A{
<code> public $age = 22; private $money = 10; public function subtell(){ parent::tell(); echo $this->age,'<br>'; } public function subMoney() { parent::sayMoney(); echo $this->money,'<br>'; }</code>
}
$b = new B();
$b->subtell();//22 1 22;
echo '
最后一句话报错Using $this when not in object context
但在调用subMoney()时不就绑定了$this,$this指向b对象,之后执行parent::sayMoney();由于静态调用,所以不绑定$this.在sayMoney()执行的时候不应该得到2000吗,为什么会报错,和前面$b->subtell();调用有啥不一样