参考程序:#include<iostream>usingnamespacestd;template<typenameT>classMAX{public:MAX(Ta,Tb,Tc);//默认构造函数TGetMaxItem();//模板成员函数private:Tx1,x2,x3;//3个带有泛型T的成员变量};template<typenameT>MAX<T>::MAX(Ta,Tb,Tc){x1=a;x2=b;x3=c;}template<typenameT>TMAX<T>::GetMaxItem(){Tm;m=(x1>x2)?x1:x2;m=(m>x3)?m:x3;returnm;}intmain(){MAX<int>mint(1,3,2);cout<<mint.GetMaxItem()<<endl;return0;}