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

C++ Program The Base Class: Shape Clas:s Design a class named Shape

with the following member variables * protected: o float width o float

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!