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
Зареєструйся Зараз
або Підпишись на майбутні тести