previous | start | next

A Correct Non-Member operator+

We can easily fix this by using the public getX and getY

Pair operator+(int d, const Pair& other)
{
  int xval = d + other.getX();
  int yval = d + other.getY();

  return Pair(xval, yval);
}



previous | start | next