enum
Class Diagram
Ancestor class specifications:
enum
Class Specification
Note
The enum class is designed to be used for creating enumerated data types. Below is such an example declaration. (This example is used in the example portions of method specifications.)
private enum DayOfWeek
{sunday, monday, tuesday, wednesday, thursday, friday, saturday};
private DayOfWeek oneDay;
Query
Methods
public String name( )
post: result == the name of the constant currently assigned to this
object
example:
If oneDay is DayOfWeek.tuesday, then oneDay.name() returns tuesday
public int ordinal( )
post: result == the ordinal of the constant currently assigned to this
object
example:
If oneDay is DayOfWeek.tuesday, then oneDay.ordinal() returns 2