Code For NonGeek
Would you like to react to this message? Create an account in a few clicks or log in to continue.

What is a template?

Go down

What is a template? Empty What is a template?

Post  skyboard Wed Sep 21, 2011 11:54 pm

Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two following ones:


template <class indetifier> function_declaration; template <typename indetifier> function_declaration;

The only difference between both prototypes is the use of keyword class or typename, its use is indistinct since both expressions have exactly the same meaning and behave exactly the same way.

skyboard

Posts : 31
Join date : 2011-09-03

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum