diff options
Diffstat (limited to 'primerplus11.6-oprt_ovrlding.cc')
-rw-r--r-- | primerplus11.6-oprt_ovrlding.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/primerplus11.6-oprt_ovrlding.cc b/primerplus11.6-oprt_ovrlding.cc new file mode 100644 index 0000000..6c4b147 --- /dev/null +++ b/primerplus11.6-oprt_ovrlding.cc @@ -0,0 +1,30 @@ +#include <iostream> +#include "mytime0.h" + +int main(void) +{ + using std::cout; + using std::endl; + + Time planning; + Time coding(2, 40); + Time fixing(5, 55); + Time total; + + cout << "planning time = "; planning.Show(); cout << endl; + cout << "coding time = "; coding.Show(); cout << endl; + cout << "fixing time = "; fixing.Show(); cout << endl; + total = coding + fixing; + + // operator notation + cout << "coding + fixing = "; total.Show(); cout << endl; + + Time morefixing(3, 28); + cout << "more fixing time = "; morefixing.Show(); cout << endl; + total = morefixing.operator+(total); + + // function notation + cout << "morefixing.operator+(total) = "; total.Show(); cout << endl; + + return 0; +} |