Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is the difference between compile-time and runtime polymorphism?

  1. A Templates resolve at compile time with no runtime cost; virtual functions resolve through a vtable at runtime
  2. B Templates are slower
  3. C Virtual functions resolve at compile time
  4. D They are the same mechanism
Answer

Templates resolve at compile time with no runtime cost; virtual functions resolve through a vtable at runtime

Templates allow inlining but increase compile time and binary size. Virtual functions allow heterogeneous collections behind one base pointer.

All C++ MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as