填空题
在下面横线上填上适当的语句,完成程序。
#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;
【参考答案】
Derived (int i):Base(i){
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
下面是“二维向量”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】 );
点击查看答案&解析
填空题
下列程序的输出结果是 【8】 #include<iostream> using namespace std; int main() int num=500; int &ref=num; ref +=100; cout<<num<<end1; return 0;
点击查看答案
相关试题
有以下程序: #include<iostream.h> ...
下面程序的输出结果是 【15】 。 #in...
已知:double A(double A) return++...