home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_03 / 1003075a < prev    next >
Text File  |  1992-01-13  |  457b  |  34 lines

  1.  
  2. Listing 8
  3.  
  4. //
  5. // rational.cpp
  6. //
  7. #include "mylib.h"
  8. #include "rational.h"
  9.  
  10. rational rational::operator-()
  11.     {
  12.     rational result(*this);
  13.     result.num = -result.num;
  14.     return result;
  15.     }
  16.  
  17. rational rational::operator++(int)
  18.     {
  19.     rational result(*this);
  20.     *this += 1;
  21.     return result;
  22.     }
  23.  
  24. rational rational::operator--(int)
  25.     {
  26.     rational result(*this);
  27.     *this -= 1;
  28.     return result;
  29.     }
  30.  
  31. // ... the rest of rational.cpp as in Listing 2
  32.  
  33.  
  34.