Define a class Shape in c++ having an attribute Area and a pure virtual function Calculate_Area. Also
Question:
Define a class Shape in c++ having an attribute Area and a pure virtual function Calculate_Area. Also include the following in this class
. ● A constructor that initializes Area to zero.
● A method Display_Area() that displays the value of member variable “Area”.
● A virtual method Print_Area() that displays the value of member variable “Area”. Now derive three classes from Shape; Circle having attribute radius, Square having attribute Length and Rectangle having attributes Length and Breadth. Include the following in each class.
● A constructor that takes values of member variables as argument.
● A method Display_Area() that overrides Display_Area() method of Shape class.
● A method Print_Area() that overrides Print_Area() method of Shape class.
● A method Calculate_Area() that calculates the area as follows: Area of Circle= PI* Radius^2 Area of Square=Length^2 Area of Rectangle=Length*Breadth Make a driver program to test above classes.
Systems analysis and design
ISBN: ?978-1118808177
5th edition
Authors: Alan Dennis, Barbara Haley Wixom, Roberta m. Roth