0

can any one tell me what is the actual difference bet function & template?

12th Oct 2016, 10:01 AM
faisal shaikh
2 ответов
+ 1
As the previous comment mentions, functions without using templates require you to explicitly tell the compiler which data types you want to pass and return. However, templates help you make functions "universal" by applying a specific type to a template on run time. Which basically means you can pass any data type to a function that you want. This is usually advised if you overload a function to support another data type with each overload. With templates you could make one single function.
12th Oct 2016, 5:34 PM
Matan Cohen
Matan Cohen - avatar
0
functions take determined types of variables but for templates it doesn't matter
12th Oct 2016, 10:10 AM
Ahmet Sercan Sağman