What this C++ class-size interview question tests
This question probes your understanding of how the C++ object model handles classes with no data members. It is a deceptively simple question that reveals whether you understand the distinction between the logical structure of a class and its physical memory layout.
Candidates should be able to reason about what the compiler must guarantee for every object, how that requirement applies even in the absence of user-defined data, and the language rules that govern this behaviour. This is the kind of foundational knowledge that separates candidates with deep C++ intuition from those who rely on surface-level patterns.
- Object identity and the one-definition rule
- Compiler behaviour and the abstract machine
- Empty base optimisation and its limits