Reusing enum values in separate enum types
问题 Is there a way to reuse the same enum value in separate types? I'd like to be able to something like the following: enum DeviceState { UNKNOWN, ACTIVE, DISABLED, NOTPRESENT, UNPLUGGED }; enum DeviceType { UNKNOWN, PLAYBACK, RECORDING }; int _tmain(int argc, _TCHAR* argv[]) { DeviceState deviceState = DeviceState::UNKNOWN; DeviceType deviceType = DeviceType::UNKNOWN; return 0; } This makes sense to me, but not to the C++ compiler- it complains: error C2365: 'UNKNOWN' : redefinition; previous