Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ChildClass_Car.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class ChildClass_Car(Car):
def __init__(self, brand, model, year, doors, battery_capacity):
super().__init__(brand, model, year, doors)
self.battery_capacity = battery_capacity

def display_info(self):
"""Override the parent class method for an ChildClass_Car."""
return (
f"ChildClass_Car: {self._brand} {self._model}, {self.doors} doors, "
f"Battery Capacity: {self.battery_capacity} kWh ({self._year})"
)

def charge(self):
"""Specific method for charging an electric car."""
return "Charging the battery..."