What this C++ references interview question tests
This is an easy C++ language-knowledge question that probes your understanding of reference semantics in class contexts. Quant firms use questions like this to verify that candidates have a solid grasp of fundamental C++ behaviour before moving to more complex memory-management and performance scenarios.
To answer correctly, you need to reason about how references behave when declared as class members, how they are initialized, and what happens during object construction and assignment. The question rewards careful attention to C++ rules around reference binding and lifetime, rather than guesswork.
- Reference binding and initialization rules
- Class member references and constructor semantics
- Const and non-const reference behaviour
- Compilation errors vs. runtime behaviour