0
can any one tell me what is the actual difference bet function & template?
2 odpowiedzi
+ 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.
0
functions take determined types of variables but for templates it doesn't matter