Xenos said:
I just tried defining the above enums in a test program, and g++
complained
because they contained the same identifier names for the elements. It
this
really legal?
Apparently I was mistaken on this point. When both names are visible in the
current scope(s), this would amount to illegal name overloading, and won't
compile. They'd have to be in different namespaces (also, I think, within
separate classes would work?)
So my example won't compile. If, however, enumXYZ was in namespace nsXYZ,
then you could use it by specifying nsXYZ::eMin, for example, (which is what
I suggested was probably better to do anyway). But you don't have to
specify the name of the enumeration in order to access its members. This
fact (that the names of the members are not restricted to having the enum
type itself specified) is exactly what makes it illegal to have the same
member name in multiple enums in the same scope: both names are visible at
the scope level, and therefore you can't have two of them declared there!
Sorry about that!
-Howard