circle.h
#define CIRCLE_H
class Circle
{
double r;
public:
Circle(double r);
Circle(const Circle &cricle);
~Circle();
double count_area() const;
friend double count_girth(const Circle &circle);
double count_area_sum(const Circle &circle) const;
};
#endif
circle.cpp
static const double pi = 3.14;
Circle::Circle(double r)
{
this->r = r;
}
Circle::~Circle()
{
}
Circle::Circle(const Circle &cricle)
{
this->r = cricle.r;
}
double Circle::count_area() const
{
return pi * r * r;
}
double Circle::count_area_sum(const Circle &circle) const
{
double sum = 0.0;
sum = this->count_area() + circle.count_area();
return sum;
}
double count_girth(const Circle &circle)
{
return 2 * pi * circle.r;
}