abstract_car.php abstract class car { abstract public function getMaximunSpeed(); } FastCar.php include_once 'abstract_car.php'; class FastCar extends car { protected $speedLimit; public function __construct($speedLimit) { $this->speedLimit = $speedLimit; } public function getMaximunSpeed() { return $this->speedLimit; } } Street.php include_once 'FastCar.php'; class Street extends FastCar { protected $speedLimit; protected $cars; public function __construct($speedLimit = 200) { $this->cars = array(); $this->speedLimit = $speedLimit; } //$car is object public function isStreetLegal($car) { if($car->getMaximunSpeed() < $this->speedLimit) { return true; } else { return false; } } public function addCar($car) { if($this->isStreetLegal($car)) { echo 'The Car was allowed on the road'."<br/>"; $this->cars[] = $car; print_r($this->cars); } else { echo 'The Car is too fast and was not allowed on the road'; } } } $street = new Street(); $street->addCar(new FastCar(199));