Which C++ feature enables a function call to be resolved at runtime based on the actual object type?

Options

  • A. Function overloading alone
  • B. A non-virtual member function
  • C. A virtual function used through a base pointer or reference
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. A virtual function used through a base pointer or reference

Detailed Explanation

Correct Answer: Option C

Explanation:
Runtime polymorphism is commonly achieved through virtual functions. When a virtual function is called through a base-class pointer or reference, the overridden function corresponding to the actual object type is selected at runtime.