Form a more perfect Union.
– The people
struct Layout; struct Names; Structures and Classes; Structures and Arrays; Type Equivalence; Plain Old Data; Fields
• Unions
Unions and Classes; Anonymous unions
enum classes; Plain enums; Unnamed enums
• Advice
The key to effective use of C++ is the definition and use of user-defined types. This chapter introduces the three most primitive variants of the notion of a user-defined type:
• A struct (a structure) is a sequence of elements (called members) of arbitrary types.
• A union is a struct that holds the value of just one of its elements at any one time.
• An enum (an enumeration) is a type with a ...
No credit card required