diff --git a/ex8.3/Shape.hh b/ex8.3/Shape.hh new file mode 100644 index 0000000..fc8f92d --- /dev/null +++ b/ex8.3/Shape.hh @@ -0,0 +1,16 @@ +#ifndef SHAPE_HH +#define SHAPE_HH + +class Shape { +public: + + // Constructor, destructor + Shape() {} ; + virtual ~Shape() {} ; + + // Pure virtual interface functions + virtual double surface() const = 0 ; + virtual double circumference() const = 0 ; +} ; + +#endif diff --git a/ex8.3/Square.hh b/ex8.3/Square.hh new file mode 100644 index 0000000..fda5e54 --- /dev/null +++ b/ex8.3/Square.hh @@ -0,0 +1,23 @@ +#ifndef SQUARE_HH +#define SQUARE_HH + +#include "Shape.hh" + +class Square: public Shape { +public: + + // Constructor, destructor + Square(double size) : _size(size) {} ; + virtual ~Square() {} ; + + // Implementation of abstract interface + virtual double surface() const { return _size * _size ; } + virtual double circumference() const { return 4 * _size ; } + +private: + + double _size ; + +} ; + +#endif