1 | class myInt { |
---|---|
2 | private: int theValue; |
3 | public: myInt() : theValue(0) {} |
4 | public: myInt(int _x) : theValue(_x) {} |
5 | int val() { return theValue; } |
6 | }; |
7 | |
8 | class myIntAndStuff { |
9 | private: |
10 | int theValue; |
11 | double theExtraFluff; |
12 | public: |
13 | myIntAndStuff() : theValue(0), theExtraFluff(1.25) {} |
14 | myIntAndStuff(int _x) : theValue(_x), theExtraFluff(1.25) {} |
15 | int val() { return theValue; } |
16 | }; |
17 | |
18 | class myArray { |
19 | public: |
20 | int array[16]; |
21 | }; |
22 | |
23 | class hasAnInt { |
24 | public: |
25 | myInt theInt; |
26 | hasAnInt() : theInt(42) {} |
27 | }; |
28 | |
29 | myInt operator + (myInt x, myInt y) { return myInt(x.val() + y.val()); } |
30 | myInt operator + (myInt x, myIntAndStuff y) { return myInt(x.val() + y.val()); } |
31 | |
32 | int main() { |
33 | myInt x{3}; |
34 | myInt y{4}; |
35 | myInt z {x+y}; |
36 | myIntAndStuff q {z.val()+1}; |
37 | hasAnInt hi; |
38 | myArray ma; |
39 | |
40 | return z.val(); // break here |
41 | } |
42 |