为什么代码对了,编译器说有很多错误运行不出来
#include<iostream>using namespace std;
#include<string>
template<class T1,class T2>
class Person
{
public:
Person(T1 name,T2 age)
{
this->m_Name = name;
this->m_Age = age;
}
void showPerson()
{
cout << "姓名" << this->m_Name << "年龄" << this->m_Age << endl;
}
T1 m_Name;
T2 m_Age;
};
void printPerson1(Person<string,int>&p)
{
p.showPerson();
}
void test01
{
Person<string,int>p("孙悟空",100);
printPerson1(p);
}
int main()
{
test01();
system("pause");
return 0;
}