[试题]

( 11 )请在如下程序中的空格处填写正确的语句:

#include<iostream>

using namespace std;

class Base{

public:

void fun(){cout<<"Base fun"<<endl;}

};

class Derivde:public Base{

public:

void fun(){

___________// 调用基类的函数 fun()

cout<<"Derived fun"<<endl;

}

};

参考答案与解析:

相关试题

请在下列程序中的空格处填写正确的语句: class Sample{ public

[主观题]请在下列程序中的空格处填写正确的语句:class Sample{public:Sample( ){ }~Sample( ){ }void SetData(int datA) {//将Sample类成员变量data设置成形参的值______}private:int data;};

  • 查看答案
  • 有如下程序:#include<iostream>#include<iomanip

    [单选题]有如下程序:#include<iostream>#include<iomanip>using namespace std;int main(){int S[]={123,234};cout<<right<<setfill(‘*’)<<setw(6);for(int i=0;i<2;i++){cout<<s[i]<<endl;}retum 0;}运行时的输出结果是A.123B.***123C.***123D.

  • 查看答案
  • 有如下程序:#include<iostream>#include<iomanip

    [单选题]有如下程序:#include<iostream>#include<iomanip>using namespace std;int main(){cout<<setw(10)<<setfill(’X’)<<setprecision(8)<<left;cout<<12.3456793<<______<<98765;return 0;}若程序的输出是12.345679x98765xxxxx,则划

  • 查看答案
  • 有如下程序:#include<iostream>#include<cstring

    [单选题]有如下程序:#include<iostream>#include<cstring>using namespace std;class XCD{char*a;int b;public:XCD(char;l:aa,int bB){a=flew char[strlen(aA)+1];strcpy(a,aA);b=bb;}char*lE Geta(){return a;}int Getb(){return b;}};int main(){char*pl=”abcd”.*p2=”w

  • 查看答案
  • 有如下程序:#include<iostream>#include<cstring

    [单选题]有如下程序:#include<iostream>#include<cstring>using namespace std;class XCF{int a;public:XCF(int aa=O):a(aA){cout<<”1”;}XCF(XCF&X){a=x.a;cout<<”2”;}~XCF(){cout<<at}int Geta(){return at}};int main(){XCF dl(5),d2(d1);XCF半pd

  • 查看答案
  • ( 11 )有如下程序:#include<iostream>using name

    [试题]( 11 )有如下程序:#include<iostream>using namespace std;class Monitor{public:Monitor ( char t ) : type ( t ) {}void print ( ) const{cout<<"The type of monitor is"<<type<<endl;}private:char type;};class Computer{public:C.omputer ( i

  • 查看答案
  • ( 28 )有如下程序:#include<iostream>#include<c

    [单选题]( 28 )有如下程序:#include<iostream>#include<cstring>using namespace std;class XCF{int a;public:XCF ( int aa=0 ) : a ( aa ) {cout<<"1" ; }XCF ( XCF& x ) {a=x .a; cout<<"2" ; )~XCF () {cout<<a;}int Geta () {return a;}};

  • 查看答案
  • ( 27 )有如下程序:#include<iostream>#include<c

    [单选题]( 27 )有如下程序:#include<iostream>#include<cstring>using namespace std;class XCD{char* a;int b;public:XCD ( char* aa, int bb ) {a=new char[strlen ( aa ) +1];strcpty ( a,aa ) ;b=bb;}C.har* Geta () {return a; )int Getb () { return b;}};int main

  • 查看答案
  • ( 34 )有如下程序:#include<iostream>#include<i

    [单选题]( 34 )有如下程序:#include<iostream>#include<iomanip>Using namespace std;int main(){int s[]={123, 234};cout<<right<<setfill('*')<<setw(6);for(int i=0; i<2; i++) { cout<<s[i]<<endl; }return 0;}运行时的输出结果是A. ) 123

  • 查看答案
  • 有如下程序:#include<iostream>#include<cmath>u

    [单选题]有如下程序:#include<iostream>#include<cmath>using std::cout;class Point{public:friend double distance(const Point &p); //P距原点的距离Point(int xx=0,int yy=0):x(xx),Y(YY){}//①private:int x,y;};double distance(const Point &p){ //②return sqrt(

  • 查看答案
  • ( 11 )请在如下程序中的空格处填写正确的语句:#include<iostre