Would you put an enum in another class?
Hello,
Just wanted to ask wheather it is good coding practice to put an enum into another class? or it is the same story as with inner classes.
Basically I have a class witch requires some defined values, and so I am going to use enum's. However I am unsure wheather it is an accepted practice to set this enum inside the object itself, or else define it as another entity!!
What is the best pactice for this?
regards,
Sim085
[463 byte] By [
sim085a] at [2007-10-3 3:15:13]

I'd say if the only part interpreting the enum values is the class (i.e. the only methods taking the enum as a parameter are part of this class) then you could put it into the class as a "inner enum". Otherwise I'd make it a top-level type.
I don't claim to present the best practice, just my personal opinion.
thanks :)well I actually need it from the outside, however stricktly related with the object being used.I am gona make it an inner enum for now, then change it if needed :)Thanks :)Regards,Sim085