What this C++ accessibility and scope interview question tests
This is an easy question designed to probe your understanding of access control and visibility in C++. Interviewers use it to confirm that you can read code quickly and reason about what will and won't compile—a foundational skill for any role involving code review or debugging.
To answer it, you need to identify the access levels of class members, understand how inheritance and visibility rules interact, and determine whether a given piece of code will produce output, fail to compile, or produce an error at runtime. The question rewards careful attention to modifier keywords and scope boundaries over any complex algorithmic thinking.
- Public, private, and protected member access
- Inheritance and member visibility
- Compilation vs. runtime errors