Question 85Asked in BPSC TRE 2.0 (2023) Computer Class 9-10How do structures and classes in C++ differ?
- AIn structures, members are private by default whereas in classes, they are public by default
- BIn structures, members are public by default whereas in classes, they are private by default
- CStructures cannot have private members whereas classes can have
- DMore than one of the above
- ENone of the above
Show answerHide answer
Correct answer: (B) In structures, members are public by default whereas in classes, they are private by default
Explanation
In C++ the members of a struct are public by default, while those of a class are private by default.