home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0907.CPP
-
- //---------------------------------------------------------
- // files in this example:
- // %F,15,EX0900.H%EX0900.H definition of Fraction class
- // %F,15,EX0900.CPP%EX0900.CPP Fraction members & friends
- // EX0907.CPP this file
- //---------------------------------------------------------
-
- #include <iostream.h>
- #include "EX0900.H"
-
- void main()
- {
- Fraction a(1.0), b(0.0); // create 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 = a.operator++(0); // use the nonstatic member
- cout << " The value of a is: ";
- cout << a;
- cout << " The value of b = a.operator++(0) is: ";
- cout << b;
- cout << endl;
- }
-