A.get()<<b.get(); return 0
A.55
B.57
C.75
D.77
[单选题]有如下程序: #include<iostream) using namespace std; classBase{ public: Base(int x=0){cout<<x;} }; Class Derived:public Base{ public: Derived(int x=0){cout<<x;} private: Base Val; }; int main(){ Derived d(1); returnA.100B.000C.010D.001
[单选题]有如下程序: #include<iostream) using namespace std; classBASE{ public: ~BASE(){cout<<“BASE”;} }; class DERIVED:public BASE{ public: ~DERIVED(){COUt<<“DERIVED”;} }; int main(){DERIVED x;return 0;} 执行后的输出结果是( )。A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
[单选题]有如下程序: #include<iostream) using namespace std; int main() { int*p; *p=9; cout<<“The value at p:”<<*p; return 0; } 编译运行程序将出现的情况是( )。A.编译时出现语法错误,不能生成可执行文件B.运行时一定输出:The value at p:9C.运行时一定输出:The value at p:*9D.运行时有可能出错
[单选题]有如下程序:#include<iostream>using namespace std;class AA{int k:protected:int n;void setK(int k){mis->k=k;}.public:void setN(int n){tllis->n=n;}};class BB:public AA{/*类体略*/};int main(){B.B X;x.n=l: //1x.setN(2); //2x.k=3: ///3X.setK(4); //4ret
[单选题]有如下程序:#include<iostream>using namespace std;class Book{public:B.ook(char*t=””){strcpy(title,t);}private:char title[40];};class Novel:public Book{public:Novel(char *t=””):Book(t){}char*Category()const{return”文学”;)};int main(){B.ook *pb;pb=new No
[单选题]有如下程序:#include<iostream>using namespace std;class Instrument{public:virtual void Display()=0;};class Piano:public Instrument {public:void Display(){/*函数体程序略*/}};int main(){Instrument s;Instrument *p=0;//…;return 0;}下列叙述中正确的是A.语句“Instrument *p=0
[单选题]有如下程序:#include<iostream>using namespace std;class Music{public:void setTitle(char*str){strcpy(title,str);}protected:char type[10];private:char title[20];};class Jazz:public Music{public:void set(char*str){strcpy(type,”Jazz”); //①strcpy(title,st
[单选题]有如下程序:#include<iostream>using namespace std;class AA{public:A.A(){tout<<‘l’;}};class BB:public AA{int k;public:B.B():k(0){cout<<…2;}B.B(int n):k(n){cout<<‘3’;}};int main(){B.B b(4),C;return 0;}A.1312B.132C.32 D、1412
[单选题]有如下程序:#include<iostream>using namespace std;class Publication{//出版物类char name[30];public:Publication(char*name=”未知名称”){strcpy(this->name,name);}const char*getName()const{return name;}virtual const char*getType()const{return“未知类型”;}};class Bo
[单选题]有如下程序:#include<iostream>using namespace std;class A{public:A.(int i):r1(i){}void print(){cout<<‘E’<<rl<<‘-’;}void print()const{cout<<‘C’<<rl*rl<<‘-’;}private:int rl:};int main(){A. a1(2); const A a2(4);a1.pri