填空题

在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。
#include <iostream>
using namespace std;
class A

public: A() cout<<’A’;
;
class B:______

public: B() cout<<’B’;
;
class C:virtual public A

public: C() cout<’C’;
;
class D:public B,public C

public: D() cout<<’D’;
;
void main() D obj;

【参考答案】

virtual publicA
<上一题 目录 下一题>
热门 试题

填空题
请在横线处填写派生类Derived的继承方式,使得程序的输出结果为Base。 #include <iostream> using namespace std; class Base public: void print() cout<< Base ; ; class Derived:______Base; int main() Derived d; d.print(); return 0;
填空题
写出下列程序的运行结果______。 #include <iostream.h> #include <fstream.h> #include <stdlib.h> void main() fstream outfile,infile; outfile.open( data.dat ,ios::out); if(!outfile) cout<< Can’t open the file. <<endl; abort(); outfile << 1234567890 <<endl; outfile<< aaaaaa.aaa <<endl; outfile<< ********** <<endl; outfile.close(); in file.open( data.dat ,ios::in); if(!infile) cout<< Can’t open the file. <<endl; abort(); char line[80]; int I=0; while(!infile.eof()) I++; infile.getline(line,sizeof(line)); cout<<I<< : <<line<<endl; infile.close();
相关试题
  • 如果类中的一个成员函数的定义实现在类内,...
  • 下列程序的输出结果是______。 #in...