+ 1
What are templates and generic programming?
in reference to c++
1 ответ
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