Can virtual functions have default arguments?
Show answer and explanation
Yes, a virtual function may declare default arguments, but the default is bound statically while the function body dispatches dynamically. A call through a base can therefore execute a derived override with the base declaration's default value, so this combination is best avoided.
Yes, a virtual function may declare default arguments, but the default is bound statically while the function body dispatches dynamically. A call through a base can therefore execute a derived override with the base declaration's default value, so this combination is best avoided.
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.