Here is my code (it works):
class Car(object): condition = "new" def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def drive_car(self): self.condition = "used" def display_car(self): return "This is a %s %s with %s MPG." % (self.color, self.model, str(self.mpg)) `class ElectricCar(Car):` def __init__(self, model, color, mpg, battery_type): self.model = model self.color = color self.mpg = mpg self.battery_type = battery_type
Now, both classes Car, and Electric cars include self, model, color and mpg.
Since they do, what is the use of inheritance when Electric car has model, color and mpg as well?
If I need class Tractor, I am going all over again to need model, color and mpg, so, WHAT IS THE USE OF CAR?