题目内容

运行下列程序时的输出结果是( )。#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

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

A. 11
B. 112
C. 121
D. 1212

运行下列程序时的输出结果是( )。#includeusing namespace std;class Base{protected: int a;public: Base(int x=1){a=x;} virtual void print() { cout<print(); }int main(void){ Derived b(2); f1(b); f2(b); f3(&b); system("pause"); return 0;}

A. 12121
B. 11212
C. 12112
D. 121212

答案查题题库