an enum inside another enum

maarten van damme maartenvd1994 at gmail.com
Thu Jul 26 04:40:06 PDT 2012


Hi, would the response to this question :
http://stackoverflow.com/questions/757684/enum-inheritance be the same
for D?

I have these two enums:
enum first : string{
 a="a",
 b="b"
}

enum second : string{
 a=first.a,
 b=first.b,
 c="c"
}

Is there a way to make this cleaner? I don't mind having something like
second.firstchar.a
with firstchar  beeing a "first" enum.

To do that I would need to tell the enum that it can also use the type
"first" because in the end, that is a string too...


More information about the Digitalmars-d-learn mailing list