Quote:
> In VC++ v6.0 I have declared:
> class CFred
> {
> public:
> // Data
> static enum Authentication {NotPerformed, Successful };
> static enum Authorization {NotPerformed, Successful,
> InvalidElectronicSerialNo, UnassignedDirectoryNo};
> ...
> and the compiler reports the following error:
> Compiling...
> xx.cpp
> ...: error C2371: 'NotPerformed' : redefinition; different basic types
> xxx.h(767) : see declaration of 'NotPerformed'
> xxx.h(768) : error C2371: 'Successful' : redefinition; different basic
types
> xxx.h(767) : see declaration of 'Successful'
> ==============================
> Since the enum cases 'NotPerformed' and 'Successful' are in different
enums
> why does the compiler flag an error?
Enums are no namespaces. So all enum values in all enums (in the same
namespace) must be different to each other and different from all other
names in the same namespace. Otherwise you would have to write
Authentication::NotPerformed etc. and most of us wouldn't like that.
Regards
Heinz