TITLE: Templates reuse source, not executables (another example) [ This example adapted from "C++ Gotchas", tutorial notes by Tom Cargill, p. 69. ] template class Queue { public: Queue (); void enqueue (const T&); T dequeue (); int empty () const; }; int main () { Queue qt; Queue qc; const char* table [] = { "table", "of", "strings", 0 }; for (int i = 0; table [i]; i++) { qt.enqueue (table [i]); int len = strlen (table [i]); char* cap = new char [len+1]; strcpy (cap, table [i]); cap [0] = toupper (cap [0]); qc.enqueue (cap); } return 0; } The executable (probably) has two copies of each member function of Queue, even though each copy has identical code. One is instantiated for the type "const char*" and another for the type "char*".