previous | start | next

Revised Pair.h

Here is the revised Pair.h

class Pair
{
  int x, y;
public:
  Pair();
  Pair(int xval, int yval);

  int getX();
  int getY();
  string toString();
  Pair add(const Pair& other);
  Pair add(int d);

  Pair operator+(const Pair& other);
  Pair operator+(int d);
  
};

Note the operator+ functions are declared (and implemented) with the same parameters as the corresponding add member functions.



previous | start | next