单选题 C++ 题号 #1545883 A.①②皆无编译错误 B.①有编泽错误,②无编译错误 C.①无编译错误,②有编译错误 D.①②皆有编译错误 收起答案及解析 进入在线模考 参考答案 C 答案解析 保护继承的类Dervied2不能访问基类Base中的公共数据成员data。 你可能感兴趣的试题 1 有如下程序: #include<iostream> using namespace std; class Base1 { public: Base1(int d) {cout<<d;} ~Base1(){} }; class Base2{ public: Base2(int d) {cout<<d;} ~Base2(){} }; class Derived:public Base1,Base2{ public: Derived(int a,int b,int c,int d); Base1(b),Base2(a),b1(d),b2(c) {} private: int b1; int b2; }; int main(){ Derived d(1,2,3,4); return 0; } 运行时的输出结果是( )。 A.1234B.2134C.12D.21 查看解析 → 2 A.B.C.D. 查看解析 → 3 查看解析 →