CodePudding user response:
Pleasure, pleasureclass Shape
{
Public:
Virtual void printArea ()=0;
};
The class Circle: public Shape
{
Public:
Circle (radius, float) : _radius (radius) {}
~ Circle () {}
Virtual void printArea () {cout & lt; <3.1415 * (_radius ^ 2) & lt;
Private:
Float _radius;
};
Class a Rectangle: public Shape
{
Public:
A Rectangle (float length, float width) : _length (length), _width (width) {}
~ a Rectangle () {}
Virtual void printArea () {cout & lt; <_length * _width & lt;
Private:
Float _length;
Float _width;
};
The class Trapezoid: public Shape
{
Public:
Trapezoid (float float top, bottom, float height) : _top (top), _bottom (bottom), _height (height) {}
~ Trapezoid () {}
Virtual void printArea () {cout & lt; <(_top + _bottom) * _height/2 & lt;
Private:
Float _top;
Float _bottom;
Float _height;
};