In C++, which of the following allows dynamic dispatch during runtime?
12 views
- Function Overloading
- Virtual Functions (Correct Answer)
- Templates
- Inline Functions
Explanation
Virtual functions enable runtime polymorphism in C++, allowing the program to decide which function implementation to invoke based on the actual object type, unlike overloading which is resolved at compile time.