ProgrammingEasyIBM · Deloitte pattern

In C++, members of a class declared without any access specifier are:

  1. A. private
  2. B. Accessible within the same file
  3. C. public
  4. D. protected

Correct answer: A. private

class members default to private, while struct members default to public. That is the only real difference between the two keywords (default inheritance follows the same rule).

More OOP with C++ and Java questions

Exams that ask this topic