double getR();//to get the radius
void setR(double r);//to set the radius
Point& getC();//to get the center
void setC(Point& c);//to set the center
double getArea();
};
Circle::Circle(int r, Point& c) : radius(r), center(c)
{}
double Circle::getR()
{
return this->radius;
}
void Circle::setR(double r)
{
this->radius = r;
}
Point& Circle::getC()
{
return this->center;
}
void Circle::setC(Point& c)
{
center = c;
}
double Circle::getArea()
{
double r = this->getR();
double pi = Circle::PI;
return pi*r*r;
}
#if 1 //set to 0 if you don't want to build the following code
#include <iostream>
int main()
{
using namespace std;
Circle circle1;
circle1.setR(1);
Point center(0, 0);
circle1.setC(center);
cout << circle1.getArea() << endl;
return 0;
}
#endif