L eh timing template member function and ordinary class member function created there is a difference:
1. Ordinary member functions start to create;
2. The class template member function is created if calling;
#include<iostream> using namespace std; class Person1 { public: void showPerson1() { cout << " This is PERSON1 " << endl; } }; class Person2 { public: void showPerson2() { cout << " This is PERSON2 " << endl; } }; // not sure of the type of obj, so here is compiled successfully Template < class T> class the Person { public : T obj; void show1() { obj.showPerson1(); } void show2() { obj.showPerson2(); } }; void the Test () { // here after passing the Person1, show1 was only to create the Person <Person1> the p-; p.show1(); //p.show2(); } int main () { test(); system("pause"); return 0; }