I am stuck on Inheritance in the Introduction to Classes section. My understanding of inheritance is that I should be able to create a new class (in this case ElectricCar) that inherits from Car. In all of the previous examples and FAQ topics I've read it looks like I have to retype all of the information from the parent class, Car. Is there a way of modifying the parent class without having to retype all of the initial information?
I've added my own code that could also use some help figuring out.
class Car(object): condition = "new" def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def display_car(self): return 'This is a %s %s with %s MPG.' %(self.color, self.model, str(self.mpg)) def drive_car(self): self.condition = "used" return self.condition class ElectricCar(Car): def __init__(battery_type): Car.__init__(self, model, color, mpg, battery_type) self.battery_type = battery_type my_car = ElectricCar("prius", "red", 99, "molten salt")