- Prefer to use scoped enumerations instead of unscoped ones.
- In order to use scoped enumerations, you should declare enumerations using enum class or enum struct:
enum class Status { Unknown, Created, Connected };
Status s = Status::Created;
The enum class and enum struct declarations are equivalent, and throughout this recipe and the rest of the book, we will use enum class.