This repository has been archived on 2021-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
2019-12-10 09:15:28 +01:00
|
|
|
#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 ; }
|
2020-01-06 19:07:30 +01:00
|
|
|
virtual const char* shapeName() const { return "Square"; }
|
2019-12-10 09:15:28 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
double _size ;
|
|
|
|
|
|
|
|
} ;
|
|
|
|
|
|
|
|
#endif
|