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
};
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.
Login in to like
Login in to comment