| 14 | } |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | std::cout << "Create i with the value 0." << std::endl; |
| 19 | Integer i; |
| 20 | i.show(); |
| 21 | |
| 22 | Integer::printCount(); // 1 object |
| 23 | |
| 24 | if (i.getValue() == 0) |
| 25 | { |
| 26 | std::cout << "Create j from object i." << std::endl; |
| 27 | Integer j {i}; |
| 28 | j.show(); |
| 29 | Integer::printCount(); // 2 objects |
| 30 | } |
| 31 | |
| 32 | Integer::printCount(); // 1 object again (Integer j was deleted because its scope ended) |
| 33 | |
| 34 | Integer array[] { 1, 2, 3 }; |
| 35 | |
| 36 | Integer::printCount(); // 4 objects |
| 37 | |
| 38 | showIntegerRef(array[0]); |
| 39 | showIntegerVal(array[1]); |
| 40 | |
| 41 | Integer::printCount(); // 4 objects again |
| 42 | } |
nothing calls this directly
no test coverage detected