Section 32.3 Combining Bitwise Operators and Enums
Bitwise operators and enums pair especially well together when each enum constant represents a single bit— a technique often used to represent a set of independent on/off options (called flags) packed into a single integer. For example:
Since
READ, WRITE, and EXECUTE each occupy a different bit position (\(0001\text{,}\) \(0010\text{,}\) \(0100\)), we can combine several permissions into one integer using bitwise OR (|), and later test whether a specific permission is set using bitwise AND (&)— all without needing a separate variable for each flag.

