PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Ken Schick  >  Vehicle Simulator  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Vehicle Simulator
Simulate the functions of different vehicle types
Author: By
Last change:
Date: 3 years ago
Size: 965 bytes
 

Contents

Class file image Download
<?php
/*
* Copyright (c) 2014 Chi Hoang
* All rights reserved
*/
require_once("vehicle.php");

$car=new Vehicle\Vehicle("car");
$car=new Vehicle\AddEngine($car,true);
$car=new Vehicle\AddWheels($car,"4");
echo
$car->travel(new Vehicle\Subject("Drive"));
echo
$car->travel(new Vehicle\Subject("Arrived"));
echo
$car->travel(new Vehicle\Subject());
$test=new Vehicle\Subject();

$bicycle=new Vehicle\Vehicle("bicycle");
$bicycle=new Vehicle\AddWheels($bicycle,"2");
echo
$bicycle->travel(new Vehicle\Subject("Drive"));
echo
$bicycle->travel(new Vehicle\Subject("Arrived"));
echo
$bicycle->travel(new Vehicle\Subject());

$motocycle=new Vehicle\Vehicle("motocycle");
$motocycle=new Vehicle\AddWheels($motocycle,"2");
$motocycle=new Vehicle\AddEngine($motocycle,true);
echo
$motocycle->travel(new Vehicle\Subject("Drive"));
echo
$motocycle->travel(new Vehicle\Subject("Arrived"));
echo
$motocycle->travel(new Vehicle\Subject());
?>