<?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