A. Write a program to implement the concept of multiple inheritance. a. Create the parent class Shape. Initialise the constructor with Shape. b. Create another class named Rectangle which inherits the...

A. Write a program to implement the concept of multiple inheritance.

a. Create the parent class Shape. Initialise the constructor with Shape.


b. Create another class named Rectangle which inherits the properties of the parent


class Shape. Define the attributes length and breadth in the Rectangle class. Initialise


the length and breadth inside the constructor of the Rectangle class. Also call the


constructor of the parent class to initialise the color of the Rectangle. Define the method


calc_area() to return the area of the rectangle.


c. Create another class named Triangle which inherits the properties of the parent class


Shape. Defi ne the attributes base and height in the Triangle class. Initialise the base


and height inside the constructor of the Triangle class. Also call the constructor of the


parent class to initialise the color of the Triangle. Defi ne the method calc_area() to


return the area of the Triangle.


d. Also create the method Tring_Details() in the Triangle class and Rect_Details() in


the Rectangle Class to return complete details about the rectangle and triangle.


e. Finally, create the instance of the Rectangle and Triangle classes to return the area of


the Rectangle and Triangle.




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here