Question 1
Back to Exercise
What is the main purpose of templates in C++?
- A Run-time type checking
- B Writing generic code once that works for many types, with code generated per type at compile time Correct
- C Replacing classes
- D Faster compilation
Correct Answer: Option B
The STL – vector, map, sort – is built entirely from templates.
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!