I have two enums in my code:
enum Month {January, February, March, April, May, June, July,
August, September, October, November, December};
enum ShortMonth {Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec};
May is a common element in both enums, so the compiler says:
Redeclaration of enumerator ‘
May‘.
Why does it say so? And how can I circumvent this?
Enum names are in global scope, they need to be unique. Remember that you don’t need to qualify the enum symbols with the enum name, you do just:
not:
For this reason, you often see people prefixing the symbol names with the enum’s name: