Logo

Question preview

Class vs Struct

What this preview is

About this preview

Class vs Struct is a cooked 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 class vs struct in C++ interviews

This foundational C++ language question tests whether a candidate understands the subtle but important distinctions between two constructs that are nearly identical under the hood. Quant firms ask this to verify that you grasp both the technical differences and the conventions that guide when to use each one in production code.

The answer requires you to articulate several layers: the default access specifiers, inheritance rules, and how aggregate initialization behaves differently. Beyond the mechanics, interviewers are listening for whether you understand the intent behind choosing one over the other — that is, what signal you send to other engineers when you pick a struct versus a class in a codebase.

  • Default member and inheritance access levels
  • Aggregate initialization and trivial types
  • Conventions around data representation versus encapsulation
  • Memory layout and the C struct legacy