<?php class Car { public $speed = 0; //汽车的起始速度是0 public function speedUp() { $this->speed += 10; return $this->speed; } } //定义继承于Car的Truck类 //c++ class Derived : public Base //php class Truck extends car class Truck extends car{ public $speed = 20; //卡车的速度是5