What is template and whats the use ? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 4

What is template and whats the use ?

4th Aug 2017, 11:07 AM
Pankaj Kumar
Pankaj Kumar - avatar
3 ответов
+ 9
to create templates of things like functions and classes. Say we needed a function that accepted two or more different data types. Instead of having to write two or more different functions we can create one template function. When the program is compiled the compiler automatically creates the required functions for you with the correct data types
4th Aug 2017, 11:10 AM
jay
jay - avatar
+ 2
@jay example please.
4th Aug 2017, 11:19 AM
Вап