diff --git a/Honda.py b/Honda.py new file mode 100644 index 0000000..0225323 --- /dev/null +++ b/Honda.py @@ -0,0 +1,19 @@ +from Vehicle import Vehicle + +class Honda(Vehicle): + def __init__(self, brand, model, year, number_of_doors): + super().__init__(brand, model, year) + self._number_of_doors = number_of_doors + + def display_info(self): + """Override the parent class method for a Car.""" + return f"Car: {self._brand} {self._model}, {self.doors} doors ({self._year})" + + def honk(self): + return "Honk honk! Move!" + + def open_trunk(self): + return "The trunk is now open." + + def fuel(self): + return "Fuel is full!" diff --git a/Vehicle.py b/Vehicle.py index 0ed9256..b8c4f1f 100644 --- a/Vehicle.py +++ b/Vehicle.py @@ -11,3 +11,16 @@ def display_info(self): def honk(self): """A general honk sound for all vehicles.""" return "Beep beep!" + +class Car(Vehicle): + def __init__(self, brand, model, year, number_of_doors): + # Call the parent class constructor + super().__init__(brand, model, year) + self._number_of_doors = number_of_doors + + def honk(self): + return "Honk honk! This is a car!" + + def open_trunk(self): + return "The trunk is now open." + diff --git a/classes-example b/classes-example new file mode 160000 index 0000000..1dfddb5 --- /dev/null +++ b/classes-example @@ -0,0 +1 @@ +Subproject commit 1dfddb50e5d9190da753a5a7cc36b34643184690