The C++ code
class cube : public body {
virtual float GetVolume();
virtual float GetSurface();
class cylinder : public body {
virtual float GetVolume();
virtual float GetSurface();
virtual float GetVolume() =0;
virtual float GetSurface() =0;
Now both “cube” and “cylinder” inherit from the class “body”, that means, they are in fact bodies (although different ones).
The functions in the cube class override the functions in “body”
The functions in the cylinder class override the functions in “body”