A.n=0
B.n=1
C.n=2
D.n=3
[单选题]有如下程序:#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
[单选题]有如下程序:#include<iostream>using namespace std;class C1{public:-Cl()}cout<<1;}};class C2:public C1{public:~c2(){cout<<2;}};int main(){C.2 cb2;C.1*cbl:return 0;{运行时的输出结果是A.121B.21C.211 D、12
[单选题]有如下程序:#include<iostream>using namespace std;class Toy{public:Toy(char*_n){strcpy(name,_n);count++;}~Toy()}count--;}char*GetName(){return name;}static int getCount(){return count;}private:char name[10];static int count;};int Toy::count=O:int mai
[单选题]有如下程序:#included<iostream>using namespace std;class CD{public:~CD(){cout<<’C’;)private:char name[80];};int main()(CD a,*b,d[2];return 0;}运行时的输出结果是A.CCCCB.CCCC.CCD.C