Which lines of the code contain errors?

struct A {
  int a;
  public: int b;
  protected: int c;
  private: int d;
};
struct B: public A {
  int fa() {return a;}  //1
  int fb() {return b;}  //2
  int fc() {return c;}  //3
  int fd() {return d;}  //4
};
Explanation
Structs came to C++ from C with default visibility of members public. Structs in C++ can be inherited but private fields are not visible to sub-structs.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты