previous | start | next

The testPair Program Revised

#include "Pair.h"

int main()
{
  Pair p1(2,3);
  Pair p2(5,5);

  Pair p3, p4;

  p3 = p1 + p2; // instead of p1.add(p2);
  p4 = p1 + 1;  // instead of p1.add(1);

  cout << "Expecting p3 = (7,8)" << endl;
  cout << "p3 = " << p3.toString() << endl;

  cout << "Expecting p4 = (3,4)" << endl;
  cout << p4.toString() << endl;

  return 0;
}


previous | start | next