Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Shape {
- protected:
- double width;
- double height;
- double radius;
- double area;
- std::string shapeName;
- public:
- Shape(double width_, double height_);
- virtual void print()=0;
- virtual double getArea()=0;
- void setRadius(double radius_);
- };
- class TwoDimensionalShape:public Shape {
- public:
- TwoDimensionalShape();
- };
- class ThreeDimensionalShape:public Shape {
- protected:
- double depth;
- double volume;
- public:
- ThreeDimensionalShape(double width_, double height_, double depth);
- virtual double getVolume()=0;
- void print();
- };
- TwoDimensionalShape::TwoDimensionalShape() : Shape(width = 0, height_ = 0) { }
- ThreeDimensionalShape::ThreeDimensionalShape() : Shape(width_, height_) { volume = -1; depth = -1; }
- Circle::Circle(double radius_) : TwoDimensionalShape() { radius = radius_; shapeName = "Circle"; }
Add Comment
Please, Sign In to add comment