What is a template in c++, C/C++ Programming

Templates permit 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 particular point they fulfil the functionality of a macro. Its prototype is any of the two following ones:

template function_declaration; template function_declaration;

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

 

 

Posted Date: 4/8/2013 5:41:08 AM | Location : United States







Related Discussions:- What is a template in c++, Assignment Help, Ask Question on What is a template in c++, Get Answer, Expert's Help, What is a template in c++ Discussions

Write discussion on What is a template in c++
Your posts are moderated
Related Questions
Program to calculate tax: float tax (float) ; int main() {                 float purchase, tax_amt, total;                 cout                 cin >> purchase

My project is compiling but the equation entered is not working

is getchar() is a C++ library function?

A: No.       While realloc() need to copy the allocation, this uses a bitwise copy operation, that will tear several C++ objects to shreds. C++ objects must be allowed to copy t

array of class objects and single inheritance

Insert values in queue - C++ program: Write a program to insert values in queue. int main()   {         int k;     Queue timeLine;     cout     for(

How would I use variables of a C++ object within a Lua function, and then call the Lua function from C++ code?

Queue - C++ program: Write a program to show the basic operations on queue. namespace stack {  const int max_size = 200;  char v(max_size);  int top=0;  void pu

1. Jewels can only be removed for polishing from either end of the necklace (i.e. head or tail) 2. Once a jewel type is removed from the necklace, all other instances of the same j

I want to take 1.1 as input but when I am declaring it as float the output is given as 1.1000000