When a struct is derived from a base class without an access specifier, as in struct D : B {}, what kind of inheritance is used?
Correct answer C. public
Explanation
The only difference between class and struct in C++ is the default access: struct defaults to public for both members and base classes, while class defaults to private. So struct D : B means public inheritance, whereas class D : B would mean private inheritance. Virtual inheritance is never a default; it always needs the virtual keyword.
Answer checked How we write and check questions
Discussion