// @topic T090m12d04x40 inheritance and virtual functions
// @brief class Shape, Rectangle, Circle
// shapes.h
#ifndef SHAPES_H_INCLUDED
#define SHAPES_H_INCLUDED
// encapsulation
// base class for drawing primitives
class Shape {
protected:
int cx; // coordinates of the shape center point
int cy;
public:
// constructors / destructor
Shape();
Shape( int cx, int cy );
virtual ~Shape() {}
// operations
//void compute_center();
int get_cx() const;
int get_cy() const;
virtual void draw() const = 0;
};//class Shape
// rectangle is a shape
class Rectangle : public Shape {
public:
static const int DEFAULT_RECT_SIZE = 10;
private:
int x1, y1;
int x2, y2;
public:
// constructor
Rectangle();
// operations
void compute_center();
int width() const;
int height() const;
void draw() const;
};//class Rectangle
// circle is a shape
class Circle : public Shape {
int m_radius;
public:
// constructors
Circle();
Circle( int cx, int cy, int radius );
// operations
void compute_center();
int radius() const;
void draw() const;
};//class Circle
#endif //SHAPES_H_INCLUDED