Question 14
Back to Exercise
Why are template definitions normally placed in header files?
- A Headers compile faster
- B The compiler needs the full definition wherever the template is instantiated Correct
- C Templates cannot be in .cpp files at all
- D For security
Correct Answer: Option B
Otherwise other files see only a declaration and the linker cannot find the instantiation.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!