Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make a template?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi,
can some one provide me with a simple example of a template? thankx
 
#include <iostream>
using namespace std;

template<typename C>
void Display(C Variable)
{
cout << C << endl;
}


int main()
{
int N = 0;
double D = 0;
Display(N);
Display(D);


return 0;
}


I didnt test this to make sure it works, but it should. I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top