Question: Look carefully at Shape.h . Note how it declares protected fields volume and surfaceArea ( so all shapes have them ) , and it requires

Look carefully at Shape.h. Note how it declares protected fields volume and surfaceArea (so all shapes have them), and it requires getVolume, getSurfaceArea, compareVolume, and compareSurfaceArea to be written in Shape.cpp. But the other functions are virtual and =0. These cannot be written in Shape.cpp, and instead MUST be written in the subclasses.
Cylinder/Cube/Sphere.cpp: In their header files, notice that in addition to the simple constructors and getters/setters, all of the pure virtual functions are listed here, still with the keyword virtual, but without the =0. All of these must be implemented per usual.

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!