第32434题 单选题
有如下C++代码,main函数中的以下访问操作,合法的是哪一项?
#include <iostream>
using namespace std;
class Base {
public:
    int a = 1;
protected:
    int b = 2;
private:
    int c = 3;
};
// 公有继承
class Derive1 : public Base {};
// 保护继承
class Derive2 : protected Base {};
// 私有继承
class Derive3 : private Base {};

int main() {
    Derive1 d1;
    Derive2 d2;
    Derive3 d3;
    // 以下为待判断的访问操作
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析