Created
October 12, 2012 11:39
-
-
Save sorbing/3878815 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
class Cars | |
{ | |
function createCar($brand) | |
{ | |
$car_obj = 0; | |
switch ($brand) { | |
case 'toyota': $car_obj = new Toyota; | |
case 'bmw': $car_obj = new Bmw; | |
default: $car_obj = new Toyota; | |
} | |
return $car_obj; | |
} | |
} | |
abstract class Car | |
{ | |
abstract function getMaxSpeed(); | |
abstract function getWeight(); | |
} | |
class Toyota extends Car | |
{ | |
public function getMaxSpeed() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment