For example: //myheader.h#include template class a {public: a (); t & max (const t &, const t &) const;}; template t & a :: Max (Const T & A, Const T & B) {RETURN A #include "myheader.h" main () {a * CLS = new a (); int A = 100; int b = 200; cout << CLS-> max (a, b) << endl; return 0;} You can follow the format above carried out. If the implementation of Class A's function Max is put it in a CPP file from the header file, the code is incorrect, the code is as follows: //myheader.h#include Template class a {public : A (); T & Max (Const T & Max (Const T &, Const T &) Const;}; // Classa.cpp # include "MyHeader.h" Template T & a :: Max (Const T & A, Const T & B) {RETURN A #include "myheader.h" main () {a * CLS = new a (); Int A = 100; int b = 200; cout << CLS-> max (a, b) << endl; return 0;} At this time, the reason is that VC6 does not support template functions in the CPP file. Realization. The solution is to put it in the header file, not necessarily placed in the header file of the defined class, can be placed in a separate header file. Note: It is actually based on the substance, and the implementation of the template function can be placed in the CPP file, but the CPP file is included in the file called the template function. The code is as follows: //myheader.h#include