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.

23rd Jul 2022, 7:26 AM
Zocimo Orozco Valencia
2 Answers
+ 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..
23rd Jul 2022, 8:47 AM
Jayakrishna 🇼🇳
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")
23rd Jul 2022, 7:26 AM
Zocimo Orozco Valencia