题目内容

运行下列程序时的输出结果是( )。#includeusing namespace std;class MyClassA{protected: int x;public: MyClassA() { x=0; } MyClassA(int a) { x=a;}};class MyClassB:public MyClassA{ int y;public: MyClassB(int a,int b):MyClassA(b) {y=a; } MyClassB(int a) { y=a; } void print() { cout<

A. 1203
B. 2103
C. 1230
D. 2130

查看答案
更多问题

运行下列程序时的输出结果是( )。#includeusing namespace std;class MyClassA{public: MyClassA( ) { cout<<"A";}};class MyClassB:public MyClassA{public: MyClassB( ) { cout<<"B";}};class MyClassC:private MyClassA{public: MyClassC( ) { cout<<"C";}};class MyClassD:protected MyClassC,MyClassB{public: MyClassD( ) { cout<<"D";}};int main(void ){ MyClassD t; system("pause"); return 0;}

ABACD
B. ACABD
CBD
D. BCD

运行下列程序时的输出结果是( )。#includeusing namespace std;class MyClassA{protected: int a;public: MyClassA( ) { a=1;} void print(){cout<

A. 1
B. 2
C. 12
D. 21

运行下列程序时的输出结果是( )。#includeusing namespace std;class MyClassA{protected: int n;public: MyClassA(int t) { n=t;} void print() { cout<

A. 12
B. 21
C. 112
D. 121

运行下列程序时的输出结果是( )。#includeusing namespace std;class MyClassA{public: MyClassA( ) { cout<<"A";}};class MyClassB:public MyClassA{public: MyClassB( ) { cout<<"B";}};class MyClassC:virtual private MyClassA{public: MyClassC( ) { cout<<"C";}};class MyClassD:protected MyClassC,MyClassB{public: MyClassD( ) { cout<<"D";}};int main(void ){ MyClassD t; system("pause"); return 0;}

ACBD
B. ABACD
C. ACABD
D. ABCD

答案查题题库