#ifndef _Rational_h_ #define _Rational_h_ /* Derived class 'Rational' */ #include "Number.h" class Rational : public Number // 'Rational' is derived from 'Number' { public: Rational( int numeratorInit = 0, int denominatorInit = 1 ); // constructor (default values: 0 and 1) virtual void read(); // read value from 'cin' virtual void write() const; // write value to 'cout' (object is not changed) bool isPositive() const; // return true, if object is positive (object is not changed) bool operator==( Rational other ) const; // return true if object and argument are equal (object is not changed) Rational operator+( Rational other ) const; // return sum of argument and object (object is not changed) Rational operator-( Rational other ) const; // return difference of argument and object (object is not changed) Rational operator*( Rational other ) const; // return product of argument and object (object is not changed) Rational operator/( Rational other ) const; // return division of object by argument (object is not changed) private: int numerator, denominator; // The numerator and denominator of the fraction }; #endif