enum Type Status
Local variable gameStatus (line 24) is declared to be of a new type called Status (declared at line 11). Type Status is a private member of class Craps, because Status will be used only in that class. Status is a type called an enum type, which, in its simplest form, declares a set of constants represented by identifiers. An enum type is a special kind of class that’s introduced by the keyword enum and a type name (in this case, Status). As with classes, braces delimit an enum declaration’s body. Inside the braces is a comma-separated list of enum constants, each representing a unique value. The identifiers in an enum must be unique. You’ll learn more about enum types in Chapter 8.
Good Programming Practice 6.1
Use only uppercase ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access