Guest User

Untitled

a guest
Oct 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class Shape {
  2. protected:
  3. double width;
  4. double height;
  5. double radius;
  6. double area;
  7. std::string shapeName;
  8.  
  9. public:
  10. Shape(double width_, double height_);
  11. virtual void print()=0;
  12. virtual double getArea()=0;
  13. void setRadius(double radius_);
  14. };
  15. class TwoDimensionalShape:public Shape {
  16. public:
  17. TwoDimensionalShape();
  18. };
  19. class ThreeDimensionalShape:public Shape {
  20. protected:
  21. double depth;
  22. double volume;
  23. public:
  24. ThreeDimensionalShape(double width_, double height_, double depth);
  25. virtual double getVolume()=0;
  26. void print();
  27. };
  28.  
  29. TwoDimensionalShape::TwoDimensionalShape() : Shape(width = 0, height_ = 0) { }
  30. ThreeDimensionalShape::ThreeDimensionalShape() : Shape(width_, height_) { volume = -1; depth = -1; }
  31. Circle::Circle(double radius_) : TwoDimensionalShape() { radius = radius_; shapeName = "Circle"; }
Add Comment
Please, Sign In to add comment