23 lines
526 B
C++
23 lines
526 B
C++
#ifndef CIRCLE_HH
|
|
#define CIRCLE_HH
|
|
|
|
#include "Shape.hh"
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
class Circle: public Shape {
|
|
public:
|
|
|
|
// Constructor, destructor
|
|
Circle( double radius ) : _radius(radius) {} ;
|
|
virtual ~Circle() {} ;
|
|
|
|
// Implementation of abstract interface
|
|
virtual double surface() const { return M_PI * _radius * _radius ; }
|
|
virtual double circumference() const { return 2 * M_PI * _radius ; }
|
|
virtual const char* shapeName() const { return "Circle"; }
|
|
|
|
private:
|
|
double _radius ;
|
|
} ;
|
|
#endif
|