What is the default inheritance access mode for a class in C++ when no access specifier is written?

Options

  • A. Public
  • B. Protected
  • C. Private
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. Private

Detailed Explanation

Correct Answer: Option C — Private

Explanation: Class inheritance is private by default. For example, class Derived : Base {} is equivalent to class Derived : private Base {}. By contrast, struct Derived : Base {} uses public inheritance by default.