Question: C++ Program The Base Class: Shape Clas:s Design a class named Shape with the following member variables * protected: o float width o float height
C++ Program


The Base Class: Shape Clas:s Design a class named Shape with the following member variables * protected: o float width o float height o string description Provide the following public accessor functions getArea () getDescription () class Shape protected float width, height; string description- [shape]"; public virtual float getArea ) (return 0;; virtualShape ) //TODO: cleanup string getDescription) return description; Inheritance: Derived Classes You will now create three classes that either directly or indirectly inherit their basic features from the shape class above 1. Design a class named Rectangle that inherits from your Shape class above. Create a constructor that accepts two floats: . o w for width o h for height The constructor will set the description-rectangle", and also set the height and width. Override the getArea () function to properly compute and return the rectangle's area. The simple calculation for that is (height * width) . The Base Class: Shape Clas:s Design a class named Shape with the following member variables * protected: o float width o float height o string description Provide the following public accessor functions getArea () getDescription () class Shape protected float width, height; string description- [shape]"; public virtual float getArea ) (return 0;; virtualShape ) //TODO: cleanup string getDescription) return description; Inheritance: Derived Classes You will now create three classes that either directly or indirectly inherit their basic features from the shape class above 1. Design a class named Rectangle that inherits from your Shape class above. Create a constructor that accepts two floats: . o w for width o h for height The constructor will set the description-rectangle", and also set the height and width. Override the getArea () function to properly compute and return the rectangle's area. The simple calculation for that is (height * width)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
