Which access specifier controls access so that a member can be used within its class and its derived classes, but not directly from unrelated external code?

Options

  • A. public
  • B. private
  • C. protected
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. protected

Detailed Explanation

Correct Answer: Option C — protected

Explanation: A protected member can be accessed by member functions and friends of its class and by derived classes, subject to C++ access rules. Unrelated external code cannot directly access it through an object.