Re: In praise of Java 1.5 enums



On Thu, 30 Jun 2005 15:12:25 GMT, Roedy Green
<look-on@xxxxxxxxxxxxxxxxxxxx> wrote or quoted :

>The big surprise came using the code. Almost nothing had to change but
>a declaration from int to the AppCat -- the enum type. Everything
>worked without a hitch first time.

You have a choice of flipping from static methods to enum instance
methods, but that is option, and a fairly mechanical.

The beauty comes when you add information to the constructor. It gets
rid of those gangly methods with strings of cases.

--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
.



Relevant Pages

  • Re: enumeration variables
    ... after all as per my understanding goes enumerations are integral data ... 'int' is not the only integral type. ... long long in C99) is implementation dependent. ... wider than int for an enum type. ...
    (comp.lang.c)
  • Re: Derived classes and overloaded methods
    ... able to implicitly convert it to an enum type. ... method from the derived class, the compiler prefers the overload found in ... int some1 ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: WS Proxy generator stripping out XSD annotation and enumeratio
    ... The enum type in the XSD was mapped to int because when generating DataSet, ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.xml)
  • Re: what is an enum?
    ... ANSI 3.5.2.2 The integer type chosen to represent the values of an enumeration type ... Once you write your own operator>> for the enum type, ... It would be even better if enum didn't convert to an int, then you couldn't mix things up accidentally. ... I think if you're forced to do a cast, it's a kind of confirmation of your intentions, telling the compiler that it's not an accident but that's what you really want. ...
    (microsoft.public.dotnet.languages.vc)