Technical Discussion :: C++
Home > Technical Interview Q&A > C++ > Discussion
111 / 187
What are the benefits of templates?
Answer:
• Templates allow implementing the concept of generic programming.
• Template allows us to generate a family of classes or a family of functions to handle different data types.
• Template classes and functions eliminate code duplication for different types and thus make the program development easier and more manageable.
• We can use multiple parameters in both the class templates and function templates.
• Like other functions, templates can be overloaded.
Asked In ::
Ishita
23 Feb, 2019 5:07 AM
• Templates allow implementing the concept of generic programming.
• Template allows us to generate a family of classes or a family of functions to handle different data types.
• Template classes and functions eliminate code duplication for different types and thus make the program development easier and more manageable.
• We can use multiple parameters in both the class templates and function templates.
• Like other functions, templates can be overloaded.
• Template allows us to generate a family of classes or a family of functions to handle different data types.
• Template classes and functions eliminate code duplication for different types and thus make the program development easier and more manageable.
• We can use multiple parameters in both the class templates and function templates.
• Like other functions, templates can be overloaded.