填空题
已知:double A(double A) return++a;和int A(in A) return++a;是一个函数模板的两个实例,则该函数模板定义为
【13】
【参考答案】
template<typename T>
TA(TA) {return a++,)
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
在下面横线上填上适当的语句,完成程序。 #include<iostream> using namespace std; class Base int x; public: Base(int i)x=i; ~Base() ; class Derived : public Base public: 【10】 完成类Derive构造函数的定义 ; int main () Derived Obj; return 0;
点击查看答案
填空题
下面是“二维向量”vector2D的定义,其中作为成员函数重载的运算符“+”的功能是将两向量的分量x和y对应相加,然后返回作为相加结果的新对象;请填空补充完整。 class vector2D double x; x分量 double y; y 分量 public: vector2D(double x0=0, double y0=0):x(x0),y(y0) void show(cout<<’ (’<<’,’<<y<<’) ’; vector2D operator + (vector2D); ; 【11】 operator + (vector2D a) return vector2D( 【12】 );
点击查看答案&解析
相关试题
有以下程序: #include<iostream.h> ...
下面程序的输出结果是 【15】 。 #in...