From 34fa42b5e3f2d125f6c95aaa4c0065bed1276bba Mon Sep 17 00:00:00 2001 From: Henney Lin Date: Tue, 24 Dec 2024 11:57:33 -0500 Subject: [PATCH] Added bike class as a child class of Vehicle --- Vehicle.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Vehicle.py b/Vehicle.py index b8d1401..7176cb9 100644 --- a/Vehicle.py +++ b/Vehicle.py @@ -20,3 +20,17 @@ def windshield_fluid(self): def brake(self): print("Braking the car.") + + +class Bike(Vehicle): + def __init__(self, brand, model, year, has_gears): + super().__init__(brand, model, year) + self.has_gears = has_gears + + def display_info(self): + """Overide display_info to include specific bike info.""" + return f"{super().display.info()} - {'with gears' if self.has_gears else 'without the gears'}" + + def ring_bell(self): + """Specific method for bikes.""" + return "Ring ring!""