/* This is the specification of an abstract class called Money To be used it has to be the base of a more specialized class Money_comp Money_UK Money_display Money_cheap However all of these must provide the same member functions. Yhe required functions are the virtual one below. */ #ifndef __Abstract_Money__ #define __Abstract_Money__ class Abstract_Money{ public: // the = 0 makes sure that the derived classes // supply the declared functions // and guarantee that objects of class Money // can not be dleaclared... only those of the // deerived classes virtual Abstract_Money operator-() = 0 ; virtual friend int operator<(Abstract_Money a, Abstract_Money b) = 0 ; virtual friend int operator==(Abstract_Money a, Abstract_Money b) = 0 ; // The following are supplied by Abstract_Money in terms of the above // functions Abstract_Money operator-(Money b); friend int operator>(Abstract_Money a, Abstract_Money b); friend int operator>=(Abstract_Money a, Abstract_Money b); friend int operator<=(Abstract_Money a, Abstract_Money b); friend int operator!=(Abstract_Money a, Abstract_Money b); }; // end class Abstract_Money #endif #ifndef __Dollars__ #define __Dollars__ class Dollars public: Abstract_Money { Dollars(const int n); Dollars(const int d0, int c0); Dollars(const double n); friend ostream& operator<<(ostream& s, Dollars n); Dollars operator+(Dollars b); Dollars operator*(int b); Dollars operator-(); friend int operator<(Dollars a, Dollars b); friend int operator==(Dollars a, Dollars b); int dollars(); int cents(); private: long int d; short int c; }; // end class Dollar #endif