Created
May 24, 2017 09:44
-
-
Save eriktorsner/8c961bfec0d08088ba0337d19077a201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Driver | |
{ | |
private $car; | |
public function __construct($car) | |
{ | |
$this->car = $car; | |
} | |
public function Drive() | |
{ | |
if ($this->car instanceof ElectricCar) { | |
$this->car->unplug(); | |
} | |
$this->car->start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment