previous | start | next

Example - Pair.cpp

#include "Pair.h"

Pair::Pair() {
  x = 0;
  y = 0;
}

Pair::Pair(int xval, int yval)
{
  x = xval;
  y = yval;
}

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

  return Pair(xval, yval);
}

Pair Pair::add(int d)
{
  int xval = x + d;
  int yval = y + d;

  return Pair(xval, yval);
}
...


previous | start | next