+ 1

What are templates and generic programming?

in reference to c++

4th Dec 2016, 9:43 AM
Bibek Ghimire
Bibek Ghimire - avatar
1 Respuesta
0
Templates are used with generics... They are predefined functions to calclulate stuff with values from unspecific datatypes. For example we wanna write a sum method which gets two numneric values and sums them up, We additionally want, that we dont have to worry about the data type, so we define our datatype with a variable T. Now we can write a funtion of the return type T to return the result. Now anybody can use our funtion and will get a result in the datatype of his function parameters
4th Dec 2016, 11:50 AM
Andreas K
Andreas K - avatar