Can you call a virtual function from a constructor or a destructor?
Show answer and explanation
A virtual call inside construction or destruction dispatches only within the class whose constructor or destructor is active. More-derived overrides are not selected because those subobjects are not yet, or are no longer, alive.
A virtual call inside construction or destruction dispatches only within the class whose constructor or destructor is active. More-derived overrides are not selected because those subobjects are not yet, or are no longer, alive.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.