Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Here is a possible implementation of the addition operator for our Point class:
class Point {
friend Point
operator+( const Point&, const Point& );
...
};
Point
operator+( const Point &lhs, const Point &rhs )
{
point new_pt;
new_pt._x = lhs._x + rhs._x;
new_pt._y = lhs._y + rhs._y;
return new_pt;
}