‹ 上一题 下一题 ›

g6-04850. GESP-6级-2024-09-单选-第02题 未做

关于以下C++代码,( )行代码会引起编译错误。

#include <iostream>
using namespace std;

class Base {
private:
    int a;
protected:
    int b;
public:
    int c;
    Base() : a(1), b(2), c(3) {}
};

class Derived : public Base {
public:
    void show() {
        cout << a << endl;    // Line 1
        cout << b << endl;    // Line 2
        cout << c << endl;    // Line 3
    }
};
  • A. Line 1
  • B. Line 2
  • C. Line 3
  • D. 没有编译错误
未选择
输入
输出

            
答案