home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0927.CPP
-
- //---------------------------------------------------------
- // files in this example:
- // %F,15,EX0920.H%EX0920.H definition of Fraction class
- // %F,15,EX0920.CPP%EX0920.CPP Fraction members & friends
- // EX0927.CPP this file
- //---------------------------------------------------------
-
- #include <iostream.h>
- #include "EX0920.H"
-
- void main()
- {
- Fraction a(1.0), b(0.0); // create two Fraction objects
-
- cout << "The initial value of a is: ";
- cout << a;
- cout << endl;
-
- b = a++; // increment Fraction a (postfix)
- cout << " The value of a is: ";
- cout << a;
- cout << " The value of b = a++ is: ";
- cout << b;
- cout << endl;
-
- b = operator++(a,0); // use the friend function
- cout << " The value of a is: ";
- cout << a;
- cout << " The value of b = operator++(a,0) is: ";
- cout << b;
- cout << endl;
- }
-