// Definition of a rational number class; a rational number object 
// will be a fraction, with a numerator and a non-zero denominator.
// Throughout, any operation which results in a denominator being zero
// generates an error.

// A class is a type (or abstract data type), with both data and operations

class Rational
{  /* the following extends the standard arthmetic operator + to rationals */
  friend Rational operator+ (Rational r1, Rational r2);

public:  /* this presents the user's view of rational numbers */

  /* Constructor */
  Rational (int num = 0, int denom = 1);  /* the rational number num/denom */
  /* if no parameters are given, use 0/1
     if the second parameter is omitted, use num/1 */

  /* I/O operations */
  void read(void); /* reads a rational of the form num / denom */
  void print(void);

  /* Return rational number as a decimal */
  double eval (void);

private:  /* the following details are for implementation only and 
             are not accessible by users */
  int numerator;
  int denominator;
};

