+ 1

Can anyone explains about Templates?

in c++ how can we use it ?

20th Jun 2018, 7:13 AM
Sanjaykrishna Hegade 🇮🇳
Sanjaykrishna Hegade 🇮🇳 - avatar
1 Respuesta
+ 5
Templates are used to reduce code in your program. Example : Suppose you want your program to have functions that take two arguments , add number and return the sum. Now you have to define same function multiple time that takes different argument (one that takes two int , one for float and so on). With templates you can write code once (i.e define function only once) and use it for different arguments.
20th Jun 2018, 9:24 AM
Meet Mehta
Meet Mehta - avatar