Ohad Aloni - CV (Résumé)

Car::engine()
Car::wipers()
Scooter::engine()
Scooter::wheelie()
Vehicle.class.php:

<?php
/*------------------------------------------------------------*/
abstract class Vehicle {
    public abstract function 
engine();
}
/*------------------------------------------------------------*/

SteeringWheel.interface.php: <?php
/*------------------------------------------------------------*/
interface SteeringWheel {
    public function 
wipers();
}
/*------------------------------------------------------------*/

Car.class.php: <?php
/*------------------------------------------------------------*/
class Car extends Vehicle implements SteeringWheel {
    
/*------------------------------------------------------------*/
    
public function engine() {
        
Mview::msg("Car::engine()");
    }
    
/*------------------------------------------------------------*/
    
public function wipers() {
        
Mview::msg("Car::wipers()");
    }
    
/*------------------------------------------------------------*/
}
/*------------------------------------------------------------*/

Handlebar.interface.php: <?php
/*------------------------------------------------------------*/
interface Handlebar {
    public function 
wheelie();
}
/*------------------------------------------------------------*/

Scooter.class.php: <?php
/*------------------------------------------------------------*/
class Scooter extends Vehicle implements Handlebar {
    
/*------------------------------------------------------------*/
    
public function engine() {
        
Mview::msg("Scooter::engine()");
    }
    
/*------------------------------------------------------------*/
    
public function wheelie() {
        
Mview::msg("Scooter::wheelie()");
    }
    
/*------------------------------------------------------------*/
}
/*------------------------------------------------------------*/


<?php
/*------------------------------------------------------------*/
/*------------------------------------------------------------*/
class Abstracts {
    private 
$phpFiles;
    
/*------------------------------------------------------------*/
    
public function __construct() {
        
$this->phpFiles = array(
            
"Vehicle.class.php",
            
"SteeringWheel.interface.php",
            
"Car.class.php",
            
"Handlebar.interface.php",
            
"Scooter.class.php",
        );
        foreach ( 
$this->phpFiles as $phpFile )
            require_once(
$phpFile);
    }
    
/*------------------------------------------------------------*/
    
public function index() {
        
$car = new Car;

        
$car->engine();
        
$car->wipers();

        
$scooter = new scooter;

        
$scooter->engine();
        
$scooter->wheelie();

        echo 
"<pre>\n";
        foreach ( 
$this->phpFiles as $file ) {
            echo 
"$file:\n";
            
highlight_file($file);
        }
        echo 
"</pre>\n";
    }
    
/*------------------------------------------------------------*/
}
Running Time: 3.727 milliseconds


All the source code on this site is in the public domain
© Ohad Aloni 2018