根据答案写的调用父类。请大神看看哪里错了
<?php class Car { public $speed = 0; //汽车的起始速度是0 public function speedUp() { $this->speed += 10; return $this->speed; } } //定义继承于Car的Truck类 class Truck extends Car{ public function speedUp(){ $this->speed=parent::spendUp()+50; } } $car = new Truck(); $car->speedUp(); echo $car->speed;
我是看着答案一个字一个字打出来的。。。。是这道题有问题么?