填空题
在下面横线上填上适当的语句,完成程序。
#include<iostream>
using namespace std;
class Base
int x;
public:
Base (int i)x=i;
~Base()
;
class Derived:public Base
public:
//完成类Derive构造函数的定义
;
int main()
Derived Obj;
return 0;
在横线处应填入的语句是
【11】
。
【参考答案】
Derived (int i):Base (i){}
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
虚函数必须是类的 【12】 。
点击查看答案&解析
填空题
假定用户没有给一个名为MyClass的类定义析构函数,则系统为其定义的默认析构函数首部形式为 【7】 。
点击查看答案&解析
相关试题
下面是复数类complex的定义,其中作为友元...
若有以下程序: #include<iostream> u...
【13】 允许用户为类定义一种模式,使得...
以下程序运行后的输出结果是 【10】 #...
下面程序的运行结果是 【9】 。 #inCh...