填空题 补充完整下面的模板定义: template<class Type> //Type为类型参数 class Xtwo{ //由两个Type类型的数据成员构成的模板类 Type a; Type b; public: Xtwo(Type aa=0,Type bb=0):a(aa),b(bb){} int Compare( ){ //比较a和b的大小) if(a>b) return 1; else if(a= =b) return 0; else return -1; } Type Sum( ){return a+b;)//返回a和b之和 Type Mult( ); //函数声明,返回a和b之乘积 }; template<class Type> ______::Mult( ){ return a*b;}//Mult函数的类外定义
  • 1、
【正确答案】 1、Type xtwo<Type>    
【答案解析】[解析] 在模板外对成员函数的声明格式是: template<模板形参表声明> <返回类型><类名><<模板形参表>>::<函数名>(<函数形参表>)<函数体>