the question is to creat abase class called shape and we need to use this class to store two double type values that could be used to compute the area of figures.then we need to derive two specific class called tringle and rectangle from the base class shape. after that add the base class amember function get data() to intilize base class data members and another member function display_area to compute and display the area of figures.then we need to make display area as avirtual function and redefine this function in the derived class to suit their requirments.

the hole idea from the question is to use the three class to design aprogram that will accept dimensions of triangle or rectangle interactively and display the area

PS: the two values given as input will be treated as lengths of two sides in the case of rectangle and abase and height in the case of triangle.plz help in this question i dont know what to do

You've pretty much stated exactly what you have to do. It's difficult to see what more advice one can give, other than to write the program for you. But I'm sure you don't want us to do your homework for you, as that rather defeats the purpose. If you really don't understand what to do ask your teacher to explain it to you.

Ask Your Question

Weekly Poll