本文整理汇总了PHP中Car::speed方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::speed方法的具体用法?PHP Car::speed怎么用?PHP Car::speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::speed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Bike
<?php
include "Models/Bike.php";
include "Models/Car.php";
include "Models/Plane.php";
$minutos = 10;
$vehicle = new Bike();
echo $vehicle->getName() . ': </br>';
echo 'velocidad: ' . $vehicle->speed() . '</br>';
echo 'maximo de pasajeros: ' . $vehicle->maxPassengers() . '</br>';
echo 'distancia: ' . $vehicle->travelDistance($minutos) . '</br> </br>';
$vehicle2 = new Car();
echo $vehicle2->getName() . ': </br>';
echo 'velocidad: ' . $vehicle2->speed() . '</br>';
echo 'maximo de pasajeros: ' . $vehicle2->maxPassengers() . '</br>';
echo 'distancia: ' . $vehicle2->travelDistance($minutos) . '</br> </br>';
$vehicle3 = new Plane();
echo $vehicle3->getName() . ': </br>';
echo 'velocidad: ' . $vehicle3->speed() . '</br>';
echo 'maximo de pasajeros: ' . $vehicle3->maxPassengers() . '</br>';
echo 'distancia: ' . $vehicle3->travelDistance($minutos) . '</br> </br>';
示例2: count
require_once __DIR__ . '/Bike.php';
require_once __DIR__ . '/Car.php';
require_once __DIR__ . '/Plane.php';
require_once __DIR__ . '/Ferry.php';
require_once __DIR__ . '/ConcretMixer.php';
$parking = new Parking();
echo count($parking);
// method count de la classe sera appelée
$brompton = new Bike('brompton', 'no engine');
$brompton->speed(10);
var_dump($brompton);
$dahon = new Bike('dahon', 'no engine');
$dahon->speed(10);
var_dump($dahon);
$zoe = new Car('zoe', 'hydrogen');
$zoe->speed(100);
var_dump($zoe);
$a320 = new Plane('A380', 'hydrogen');
$a320->speed(900);
var_dump($a320);
$concretMixer = new ConcretMixer();
var_dump($concretMixer);
//$parking->add($a320); // Impossible car non Parkable
$parking->add($brompton);
var_dump(count($parking));
$parking->add($dahon);
var_dump(count($parking));
$parking->add($zoe);
var_dump(count($parking));
$parking->add($concretMixer);
var_dump(count($parking));