diff --git a/Car.py b/Car.py index 9741b1f..67feb4e 100644 --- a/Car.py +++ b/Car.py @@ -12,3 +12,4 @@ def display_info(self): def honk(self): """Specific implementation for a car.""" return "Honk honk!" + diff --git a/Vehicle.py b/Vehicle.py index 260f28e..9c12b4b 100644 --- a/Vehicle.py +++ b/Vehicle.py @@ -15,5 +15,23 @@ def honk(self): def fuel_up(self): return "Full tank" +class Plane(Vehicle): + def __init__(self, brand, model, year, engine_type): + super().__init__(brand, model, year) + self._engine_type = engine_type + + def display_info(self): + base_info = super().display_info() + return f"{base_info} - {self._engine_type} engine" + + def honk(self): + return "Whoooosh!" + +#Testing the code +my_plane = Plane("Boeing", "747", 2019, "Jet") +print(my_plane.display_info()) +print(my_plane.honk()) + def brake(self): print("Braking the car.") +