c++ Help overloading the operators for a circle class?

tim

New member
For the circle class below, how would i,
1.Write the prototype to overload the operators +, <<, and == for the circle class Implement the

2.overloaded operator + and ==.
I've never really understood how to overload the operators and such. can someone please help? Thanks!

class Circle
{
private:
double rad;
const double pi = 3.14159;
public:

Circle();
Circle(double rad);
double getArea();

};

Circle::Circle()
: rad( 0.00)
{
}

Circle::Circle(double radius)
: rad(radius)
{
}

Double Circle::getArea()
{
Return pi * radius * radius
}
 
Back
Top