0
Inheritance
Complete the provided code to inherit the Car class from the Vehicle class, create a Car object and call its horn() method, which is inherited from the Vehicle superclass.
2 odpowiedzi
+ 2
What is your question?
Seems you hardcoded solution. May it works but it not the task asking for..
Call the horn method instead of printing..
0
class Vehicle:
def horn(self):
print("Beep!")
class Car:
def __init__(self, name, color):
self.name = name
self.color = color
print("Beep!")
obj = Car("BMW", "red")