home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0906.CPP
-
- //---------------------------------------------------------
- // files in this example:
- // %F,15,EX0900.H%EX0900.H definition of Fraction class
- // %F,15,EX0900.CPP%EX0900.CPP Fraction members & friends
- // EX0906.CPP this file
- //---------------------------------------------------------
-
- #include <iostream.h>
- #include "EX0900.H"
-
- void main()
- {
- Fraction a(1); // create a Fraction object
-
- cout << "The initial value of a is: ";
- cout << a;
- cout << endl;
-
- // increment Fraction a
- cout << "The value of ++a is: ";
- cout << ++a;
- cout << endl;
-
- // use the nonstatic member
- cout << "The value of a.operator++() is: ";
- cout << a.operator++();
- cout << endl;
-
- cout << "The final value of a is: ";
- cout << a;
- cout << endl;
- }