Which of the following is correct in C++?

a) Classes cannot have protected data members
b) Structures can have member functions
c) Class members are public by default
d) Structure members are private by default

1 thought on “Which of the following is correct in C++?”

  1. b
    Explanation: Though C does not allows member functions in structures but C++ allows structures to have member functions. Members of structures are public by default and those of classes are private by default. Classes can have protected data members.

Leave a Comment