首页/ 题库 / [单选题]在下列程序的横线处填上适当的内容,使程序的答案

在下列程序的横线处填上适当的内容,使程序执行后的输出结果为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:p

单选题
2022-03-12 14:48
A、public A
B、private A
C、protected A
D、virtual public A
查看答案

正确答案
D

试题解析
解析: 由主函数main入手,定义了类D对象obj。其中D为类B和C的公有继承,A是C的虚基类。题目中要求的输出结果为“ABCD”,依次为类A,类B,类C,类D冲构造函数的输出语句。为了保证基类通过多条路径被派生类“void print()const”,输出为print2。

标签:
感兴趣题目
有以下程序: main() { int y=10; while(y--); printf("y=%d ",y); } 程序执行后的输出结果是( )。
有以下程序: main() {int y=10; while(y--);printf("y=%d ",y); } 程序执行后的输出结果是( )。
在下列程序的横线处填上适当的内容,使程序执行后的输出结果为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:p
有以下程序#include main(){ int i=1; i=i^i; printf(%d,i);}程序运行后的输出结果是(  )。
有以下程序:#include main(){  char *s[6]={ABCD,EFGH,IJKL,MNOP,QRST,UVWX},**p; int i; p=s;  for(i=0;i<4;i++)printf(%s,p[i]); printf();}程序运行后的输出结果是(  )。
有以下程序: #include <stdio.h> main( ) { int a=7; while(a--); print[("%d ",a); } 程序运行后的输出结果是( )。
有以下程序: #include <stdio, h> main( ) { int m =0256,n =256; printf( "% o % o " ,m,n); 程序运行后的输出结果是( ) 。
有以下程序: #include <stdio. h> main( ) { unsigned int a; int b=-1; a=b; printf(" % u", a);程序运行后的输出结果是( )。
有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。
有以下程序: #include<stdio.h> main( ) {int X=011; printf("%d ",++x); } 程序运行后的输出结果是( )。
有以下程序: #include <stdio.h> #include <string.h> main() { char str[][20]={"Hello","Beijing"},*P=str[0]; printf("%d ",strlen(p+20)); } 程序运行后的输出结果是( )。
以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd 123xab"; printf("%d",(str)); } 运行后的输出结果是( )。
相关题目
若有以下程序段int x=20则执行以上语句后的输出结果是()
有以下程序: 程序运行后的输出结果是( )。
应在下列程序划线处填入的正确语句是【 】   #include   class Base   {  public:     void fun(){cout<><>
有程序:K=1DO10I=1,2DO10J=1,210K=K*I/JWRITE(*,*)KEND此程序执行后的输出结果为()
有程序:CHARACTER*6SS=‘ABCDEF’CALLSS(S)ENDSUBROUTINESS(S1)CHARACTERS1*3WRITE(*,*)S1END此程序执行后的输出结果为:()
有以下程序: #include < stdio. h > main( ) { ehar str[ ] [10] = { "China" ," Beijing" } , * p = str[o]; printf( "% s ", p + 10); }程序运行后的输出结果是( )。
有以下程序: mam() { char s[]="ABCD",*p; for( p=s+1;p<s+4;p++)printf("%s ",p); } 程序运行后的输出结果是( )。
有以下程序 main() { char s[]="ABCD", *p; for( p=s+1;p<s+4;p++) printf("%s ",p); } 程序运行后的输出结果是
有以下程序 main() { char s[]="ABCD",*p; for(p=s+1;p<s+4;p++)printf("%s ",p); } 程序运行后的输出结果是
有以下程序main( ){ char s[ ]="ABCD",*p;for(p=s+1;p<s+4;p++)printf("%s\n",p);}程序运行后的输出结果是
下列程序执行后的输出结果是______。
有以下程序: #include<stdio.h> main() { printf("%d ",NULL);} 程序运行后的输出结果是( )。
有以下程序: #include <stdio.h> main() { printf("%d ",NULL)"} 程序运行后的输出结果是( )。
有以下程序#include <stdio.h>main( ){ printf("%d\n",NULL); }程序运行后的输出结果是
有以下程序: #include<stdio.h> main() {printf("%d ",NULL)); 程序运行后的输出结果是( )。
有以下程序: #include<stdio.h> main { short C=124; C=C_; printf("%d ",c); } 若要使程序的运行结果为248,应在下划线处填入的是( )。
有以下程序:#include<stdio.h>main(){ char a='H'; a=(a>='A'&&a printf("%c",a);}程序运行后的输出结果是(  )。
有以下程序:#include main(){ int x=011; printf(%d,++x);}程序运行后的输出结果是(  )。
有以下程序(其中k的初值为八进制数):#include main(){ int k=011; printf(%d,k++);}程序运行后的输出结果是(  )。
有以下程序:#include main(){ int a=3; int b=3; printf(%d, a&b);}程序运行后的输出结果是(  )。
广告位招租WX:84302438

免费的网站请分享给朋友吧