Enumerated Types Define a new data type and list all possible values: enum Season {winter, spring, summer, fall} Then the new type can be used to declare.

Similar presentations

Presentation on theme: "Enumerated Types Define a new data type and list all possible values: enum Season {winter, spring, summer, fall} Then the new type can be used to declare."— Presentation transcript:

5
A basic enumerated type public enum CommandWord { // A value for each command word, // plus one for unrecognised commands. GO, QUIT, HELP, UNKNOWN; } Each name represents an object of the enumerated type, e.g. CommandWord.HELP. Enumerated objects are not created directly by the programmer.