Sep 17, 2002 #1 Guest_imported New member Joined Jan 1, 1970 Messages 0 hi, can some one provide me with a simple example of a template? thankx
Sep 17, 2002 #2 Jonsauce Programmer Joined Sep 7, 2002 Messages 6 Location US #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. Upvote 0 Downvote
#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.