speed; } protected function speedUp() { $this->speed += 10; } public function start(){ $this->speedUp(); } } $car = new Car(); $car->start(); echo $car->getSpeed();
没看明白要问什么