类模板成员函数类外实现
#include <iostream>
template<class typeName>
class Person
{
public:
Person(typeName name);
void show();
protected:
typeName m_name;
};
template<class typeName>
Person<typeName>::Person(typeName name):
m_name(name)
{
}
template<class typeName>
void Person<typeName>::show()
{
std::cout << "name " << m_name << std::endl;
}
int main()
{
Person<std::string> p("furong");
p.show();
return 0;
}