#3720. [GESP202409 六级 C++] 第 2 题

[GESP202409 六级 C++] 第 2 题

关于以下 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
    }
};

{{ select(1) }}

  • Line 1
  • Line 2
  • Line 3
  • 没有编译错误