#include <iostream>
template<class typeName, class typeAge>
class Person
{
public:
Person(typeName name, typeAge age):
name(name),
age(age)
{}
void show()
{
std::cout << "name " << name << std::endl;
std::cout << "age " << age << std::endl;
}
protected:
typeName name;
typeAge age;
};
int main()
{
Person<std::string, int> p("furong", 10);
p.show();
return 0;
}
$ ./a.out
name furong
age 10