Create C++ classes for an inheritance hierarchy for shapes as shown in the diagram on next
page. The Shape has a pure virtual function SurfaceArea that needs to be implemented in its
derived classes.
class Shape
{
protected:
string name;
public:
Shape(string n) : name(n) {}
virtual float SurfaceArea() = 0;
};
You need to add appropriate data members to the derived classes and implement the
SurfaceArea function as Shape2D and Shape3D class. Write a main() to test Square, Circle,
Rectangle, Cylinder, and Pyramid objects.
The answer to the question is available in the PDF file https://www.assignmentexpert.com/https://www.assignmentexpert.com/homework-answers/programming-answer-39188.pdf
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment