1) C1 prints whatever it is constructed with.
2) Inspect lines 16 and 17 very closely. Line 16 invokes the base constructor C1 with a value of 1. Line 17 is printing m_c1 + m_c1, which is 1 + 1.
3) Similarly, in C3, m_c1 is 1, m_c2 is 2, and m_c3 is 1.9, totaling 4.9.
Last edited on
I think I understod, but line 23 doesn't invokes the base constructor C1. Or not?
It does. C3 inherits from C2, which inherits from C1. The constructors are called in order from the base class up to the most derived subclass.