//第二十三模板 14将模板用作参数
//模板除了可以包括类型参数(class T)和非类型参数(int n)之外,还要台将模板作为参数包括进去
//tempalte<calss T>
//template<template<class T>class T1>
//这个T1类型有局限性,它要求我们在使用该模板时传递的参数必须是个模板类
//people<human>Jack;
//其中的human是用a模板声明的模板类,而people则是用b模板声明的模板类, Jack是用people这个模板类定义的一个对像
/*#include <iostream>
#include <string>
using namespace std;
template<class T>
class human
{
public:
human(){}
T GetAge(){ return age;}
T GetStr(){ return name;}
void SetAge(T &a){ age = a;}
void SetStr(T &b){ name = b;}
private:
T name;
T age;
};
template<template<class T>class T1>
class people
{
public:
people(){}
int GetAge(){ return s1.GetAge(); }
void SetAge(int &a){ return s1.SetAge(a); }
string GetStr(){ return s2.GetStr();}
void SetStr(string &s){ s2.SetStr(s); }
private:
T1<int> s1;
T1<string> s2;
};
int main()
{
people<human>Jack;
int i=8;
string str="hello";
Jack.SetAge(i);
cout<<Jack.GetAge()<<endl;
Jack.SetStr(str);
cout<<Jack.GetStr()<<endl;
system("pause");
return 0;
}
*/