本文整理匯總了PHP中Vehicle::move方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vehicle::move方法的具體用法?PHP Vehicle::move怎麽用?PHP Vehicle::move使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Vehicle
的用法示例。
在下文中一共展示了Vehicle::move方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: move
public function move($distance)
{
$result = parent::move($distance);
if ($result == false) {
echo 'Nema nafta! Vsichki da slizat.';
$this->passengers = 0;
}
}
示例2: Car
echo "<pre>";
print_r($cars);
*
* */
// public / private / protected
require_once "car.class.php";
require_once "truck.class.php";
require_once "plane.class.php";
$car = new Car(20, 'red', 5, 2);
$car->unloadPass(1);
$truck = new Truck(50, 'yello', 2200);
$truck->load(10);
$truck->unload(1000);
$vehicle = new Vehicle(20, 'blue');
$plane = new Plane(120, 'grey', 'AIRsoft', 1000, 8000);
$plane->drop(200);
echo "<pre>";
print_r($car);
print_r($truck);
print_r($vehicle);
$vehicle = new Vehicle(20, 'red');
$vehicle->move(20);
$vehicle->move(30);
$vehicle->move(15);
echo "<pre>";
print_r($vehicle);
$carPass = new Car(14, 'orange', 3, 3);
$carPass->loadPass(3);
echo "<pre>";
print_r($carPass);
print_r($plane);