ProgrammingHardGATE CS · TCS NQT Prime · Product Company SDE

Which kind of call in C++ is resolved using static (compile-time) binding rather than dynamic (run-time) binding?

  1. A. A call to a virtual function through a base-class pointer
  2. B. A call to a virtual function through a base-class reference
  3. C. A call to a non-virtual member function
  4. D. A call to an overridden virtual function through any pointer or reference to the base

Correct answer: C. A call to a non-virtual member function

Only virtual function calls use the vtable for dynamic dispatch; non-virtual member function calls are always resolved at compile time based on the static type of the expression.

More OOP with C++ and Java questions

Exams that ask this topic