What is a virtual function?
Show answer and explanation
A virtual function enables dynamic dispatch: a call through a base pointer or reference selects the final overrider for the object's dynamic type. Calls on objects by value can still be affected by slicing.
A virtual function enables dynamic dispatch: a call through a base pointer or reference selects the final overrider for the object's dynamic type. Calls on objects by value can still be affected by slicing.
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.