Question: C++. Design a class named Shape which is an abstract base class. Shape has two pure virtual functions, printShapeName and print. Shape contains two other

C++. Design a class named Shape which is an abstract base class. Shape has two pure virtual functions, printShapeName and print. Shape contains two other virtual functions, area and volume, each of which has a default implementation that returns a value of zero. Point class inherits these implementations (both area and volume of a point are zero) from Shape. A Point has x and y coordinate private members. Class Circle is derived from Point with public inheritence. A Circle has a volume of 0.0, so base-class member function volume is not overridden. A Circle has nonzero area, so the area function is overridden in this class. Write get and set functions to return and to assign a new radius to a Circle.

Class Cylinder is derived from Circle with public inheritance. A Cylinder has area and volume different from those of Circle, so the area and volume functions are both overridden in this class. Write get and set functions to return height and assign new height. Create one point, one circle, and one Cylinder then print the results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is a stepbystep guide on designing the classes as described in the question and a detailed C implementation Step 1 Define the Shape Abstract Base Class Pure Virtual Functions Declare printShapeN... View full answer

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!