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
You can, and should, include your enums in a namespace:
namespace
namespace DeviceState { enum DeviceState{ UNKNOWN, ACTIVE, DISABLED, NOTPRESENT, UNPLUGGED }; } namespace DeviceType { enum DeviceType{ UNKNOWN, PLAYBACK, RECORDING }; } //... DeviceType::DeviceType x = DeviceType::UNKNOWN;