类模板语法

#include
#include
using namespace std;
 
//类模板
template 
class Person
{
public:
	Person(nameType name,ageType age)
	{
		this->m_name=name;
		this->m_age=age; 
	}
	void showPerson()
	{
		cout<m_name<<' '<m_age;
	}
	nameType m_name;
	ageType m_age;
};
void test01()
{
	Person p1("fbb",100);
	p1.showPerson();
}
int main()
{
	test01();
} 

你可能感兴趣的:(c++)