{ $this->type = $type; } public function showAuto() { parent::showAuto(); echo "<div style='display:block; padding:20px; background:" . $this->color . "'><br>" . $this->capacity . " kg</div>"; } } echo '<h1>Class Car</h1><hr>'; $variable = "Car"; $car = new $variable(200, 30); echo $car->getCoords(); $car->move(400, 300); echo $car->getCoords(); echo $car->showAuto(); if (method_exists($car, "setType")) { echo 'Method setType exist<br>'; } if (property_exists($car, "x")) { echo 'property x exist<br>'; } if (class_exists("Car")) { echo 'class Car exist<br>'; } echo '<hr>'; echo '<h1>Class Truck</h1><hr>'; $truck = new Truck(200, 30, "Truck", 120, "#00ff00", 3000); $truck->move(200, 100); echo $truck->showAuto(); echo '<hr>';