填空题

请在横线处填写派生类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;

【参考答案】

public
<上一题 目录 下一题>
热门 试题

填空题
写出下列程序的运行结果______。 #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();
填空题
若有以下程序: #include <iostream> using namespace std; class Base public: void who()cout<< Base <<endl; ; class Derivedl: public Base public: void who() cout<< Derived <<endl; ; int main() Base *p; Derived1 obj1; p=&obj1; p->who(); return 0; 则该程序运行后的输出结果是______。
相关试题
  • 如果类中的一个成员函数的定义实现在类内,...
  • 下列程序的输出结果是______。 #in...
  • 在下面程序的横线处填上适当的内容,使程序...