previous | start | next

Revised Pair.cpp

For example, the Pair.cpp file would contain the same member function implementations, but with 2 more for the operator+ members:

Pair Pair::add(const Pair& other)
{
  int xval = x + other.x;
  int yval = y + othery.y;

  return Pair(xval, yval);
}

Pair Pair::operator+(const Pair& other)
{
  int xval = x + other.x;
  int yval = y + othery.y;

  return Pair(xval, yval);
}


previous | start | next