| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include <iostream> | ||
| 2 | |||
| 3 | class Bar | ||
| 4 | { | ||
| 5 | public: | ||
| 6 | 2 | Bar() : m_bar(1) | |
| 7 | 2 | {} | |
| 8 | 2 | virtual ~Bar() | |
| 9 | 2 | {} // possible compiler-generated destruction code - auto-detected and excluded | |
| 10 | |||
| 11 | 1 | void foo() const | |
| 12 | { | ||
| 13 | 1 | std::cout << "Const " << this->m_bar << std::endl; | |
| 14 | 1 | } | |
| 15 | 1 | void foo() | |
| 16 | { | ||
| 17 | 1 | std::cout << "Non const " << this->m_bar << std::endl; | |
| 18 | 1 | } | |
| 19 | |||
| 20 | private: | ||
| 21 | int m_bar; | ||
| 22 | }; | ||
| 23 | |||
| 24 | 1 | int main(int argc, char* argv[]) { | |
| 25 | 1 | Bar bar; | |
| 26 | 1 | const Bar const_bar; | |
| 27 |
1/2✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 10 not taken.
|
1 | bar.foo(); |
| 28 |
1/2✓ Branch 5 → 6 taken 1 time.
✗ Branch 5 → 10 not taken.
|
1 | const_bar.foo(); |
| 29 | |||
| 30 | 1 | return 0; | |
| 31 | 1 | } | |
| 32 |