Enumerations
Description
Enumerations are used to declare a custom type that can only have a specific set of values. They are useful for representing the state of a mechanism, or the available options for some function.
The values of a basic loosly typed enumeration (like the one above) can be implicitly converted to an integer. By default, the values of an enumeration start at 0
and increment by 1
for each value. The values of an enumeration can be explicitly set to any integer value.
Enumerations can also be strongly typed. This means that the values of the enumeration cannot be implicitly converted to an integer. This is useful for preventing bugs that could occur if the values of an enumeration were accidentally used as integers. Values of strongly typed enumerations also need to be accessed using the EnumName::VALUE_NAME
syntax.