0

Why we use template .....if we can simply create function of same.

template

31st Jul 2017, 2:40 PM
SHUBHAM P
SHUBHAM P - avatar
2 Answers
+ 1
If you want a function which can takes an int or a float as argument you can use template instead of write two same functions.
31st Jul 2017, 2:51 PM
clement
clement - avatar
+ 2
instead of writing same function for many different data types, you just write it once with templates you save time and size of code
31st Jul 2017, 2:49 PM
Eligijus Silkartas
Eligijus Silkartas - avatar