summaryrefslogtreecommitdiffstats
path: root/primerplus11.6-oprt_ovrlding.cc
blob: 6c4b147c236efd8e54b334a704aef328dda47b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
}