填空题
在下面横线上填上适当的语句,完成程序。
#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;
在横线处应填入的语句是
【14】
。
【参考答案】
Derived(int i):Base(i){}
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
以下程序的执行结果是 【15】 。 #include <iostream.h> #include <fstream.h> #include <stdlib.h> int main() fstream outfile, infile; outfile.open( D: text.dat ,ios::out); if(!outfile) cout<< text.dat can’t open <<end1; abort(); outfile<< 1234567890 <<end1; outfile<< abcdefghij <<end1; outfile.close(); infile.open( D: text.dat ,ios::in); if(!infile) cout<< text.dat can’t open <<end1; abort ( ); char textline[40]; int i=0; while(!infile.eof()) i++; infile.getline(textline,sizeof(textline)); cout<<i<< : <<textline<<end1; infile.close(); return 0;
点击查看答案&解析
填空题
在用class定义一个类时,数据成员和成员函数默认的访问权限是 【10】 :
点击查看答案&解析
相关试题
有下列程序段: #include <iostream>...
阅读下面程序: #include <iomanip. ...
以下程序的执行结果是 ( )。 #includ...
若有以下程序: #include <iost ream...
有如下类的定义。应在空格处填入的语句是 ...