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

Why must templates usually be defined in header files?

  1. A The compiler needs the definition at each point of instantiation
  2. B Headers compile faster
  3. C It is a style convention only
  4. D Linkers cannot handle templates
Answer

The compiler needs the definition at each point of instantiation

Each instantiation generates separate code, so the definition must be visible. This is why standard library headers are so large.

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