Logo

Question preview

private, public, protected

What this preview is

About this preview

private, public, protected is a easy quant interview question on language knowledge in Cpp, asked at Quant.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

Understanding access modifiers in C++

This easy question tests your grasp of C++ access control—specifically how private, public, and protected visibility rules govern what code can and cannot access. It is a foundational topic that interviewers use to confirm you understand class boundaries and encapsulation, even if the question itself is straightforward.

To answer correctly, you need to trace which members are accessible from the call site, which attempts to access them will fail at compile time, and what the output actually is. The question rewards precision: knowing not just the concept but also how C++ enforces these rules and what error or output results.

  • Class member visibility and scope
  • Compile-time vs. runtime errors
  • Inheritance and access control