ASsuming in class , i have:
class math
{
private:
int x,y;
public:
bool operator>(const math& );
bool operator<(const math& );
}
bool Point2D::operator>(const math &p)
{
return (this->x > p.x);
}
bool Point2D::operator<(const math &p )
{
return (this->x < p.x);
}
bool Point2D::operator>(const math &p)
{
return (this->y > p.y);
}
bool Point2D::operator<(const math &p )
{
return (this->y < p.y);
}
I want to compare each x value whether it larger or smaller(only compare X value) , the same thing go to Y value.
How do i implement this by using overload operator?