Hi Nigel, I checked the article which you have provided but unable to understand what exactly is the int enum pattern?
In prior releases, the standard way to represent an enumerated type was the int Enum pattern: // int Enum Pattern - has severe problems! public static final int SEASON_WINTER = 0; public static final int SEASON_SPRING = 1; public static final int SEASON_SUMMER = 2; public static final int SEASON_FALL = 3;
It means that standard way of implementing enums was as you quoted, that is using integer constants. Note that typesafe enum pattern was still not significantly more difficult, and enum keyword is just some syntactic sugar upon such pattern.
Jeroen T Wenting
Joined: Apr 21, 2006
It also provides for some rather interesting and powerful functionality to have a full firstclass type as an enumeration rather than a primitive.
Joined: Jul 11, 2001
Enums are a great way to implement simple Strategy classes with a fixed set of implementations.
The only drawback of enums is that they can't inherit from other classes (because they already implicitely inherit from the enum base class)..
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus