// include the header for the class ratpoint
#include "ratpoint.h"

// constructors and desctructor 
ratpoint::ratpoint ( )
{
  x_coord = 0;
  y_coord = 0;
}

ratpoint::ratpoint ( rational i , rational j )
{
  x_coord = i;
  y_coord = j;
}

ratpoint::ratpoint ( const ratpoint & x )
{
  x_coord = x.x();
  y_coord = x.y();
}

ratpoint::~ratpoint ( )
{
}

// overloading of the assignment operator =
ratpoint & ratpoint::operator = ( const ratpoint & x )
{
  x_coord = x.x();
  y_coord = x.y();

  // return a reference to THIS object so that we
  // can write x = y = z = ...
  return *this;
}

// overloading of the input operator
istream & operator >> ( istream & in , ratpoint & x )
{
  char ch;

  // read the x_coord
  in >> x.x_coord;
 
  // then read the y_coord
  in >> x.y_coord;

}

// overloading of the output operator
ostream & operator << ( ostream & out , const ratpoint & x )
{
  out << "(" << x.x_coord << "," << x.y_coord << ")" ;
}



