#ifndef CXX_COURSE_RATPOINT_H
#define CXX_COURSE_RATPOINT_H

// A rational point is a point with rational coordinates.

// include the header necessary for input/output
#include <iostream.h>
#include "rational.h"

// class declaration begins here
class ratpoint
{
  public:
    // constructors and destructor 
    ratpoint ( );
    ratpoint ( rational i , rational j );
    ratpoint ( const ratpoint & x );
    ~ratpoint ( );

    // accessors
    rational x ( ) const { return x_coord; }
    rational y ( ) const { return y_coord; }
    

    // overloading of the assignment operator =
    ratpoint & operator = ( const ratpoint & x );

    // overloading of the input and output operator
    friend istream & operator >> ( istream & in  ,       ratpoint & x);
    friend ostream & operator << ( ostream & out , const ratpoint & x);

  private:
    // the representation of a ratpoint x and y
    rational x_coord, y_coord;

    // error handling routine
    static void error ( char *text )
      {
        cerr << "ratpoint error: " << text << endl;
        exit(1);
      }

};
// class declaration ends here

#endif


