"a" <a@mail.com> wrote in message news:LPOQe.331380$5V4.307125@pd7tw3no...
Is it possible to do a nested enum?
For example,
private enum inside0{a,b,c}
private enum inside1{d,e,f}
private enum outside{inside0, inside1}
outside _variable=outside.inside0.a; //error here, but want a similar
way
Is it possible to set the _variable in the way similar to the above?
There's a fundamental misunderstanding about enums here. In the above
example, no nesting is occuring. In the outer namespace, you have an enum
called "inside0", and inside the namespace of the enum outside, you have an
instance called "inside0". The code above is similar to this:
public class inside0 {
public final inside0 a = new inside0();
public final inside0 b = new inside0();
public final inside0 c = new inside0();
}
public class inside1 {
public final inside1 d = new inside1();
public final inside1 e = new inside1();
public final inside1 f = new inside1();
}
public class outside {
public final outside inside0 = new outside();
public final outside inside1 = new outside();
}
As you can see from this code, you have a class named inside0, and you have
a field named inside0, and they each refer to distinct things.
- Oliver