Challenge 1: Cars and Engines!
Explore how to implement object relationships in Python by creating a Sedan class that inherits from Car and composes a SedanEngine object. Learn to manage composition, inheritance, and method calls while practicing coding with a real-world example of cars and engines.
We'll cover the following...
We'll cover the following...
Problem statement
You have to implement a Sedan class, which inherits from the Car class and contains a SedanEngine object.
Note: In such a composition relation, the
Sedanclass will be responsible forSedanEnginelifetime.
Consider this diagram for reference:
Task 1
-
The
Carinitializer should take arguments ...