填空题
补充完整下面的模板定义:
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函数的类外定义
【参考答案】
Xtwo