0

Why this compiles in c++11:

struct foo
{
  enum class Resolution { None=10, Nominal=20 };
  enum class Scale { None, Nominal };
};

while this doesn't:

struct foo
{
  enum Resolution { None=10, Nominal=20 };
  enum Scale { None, Nominal };
};

?

Ruggero Turra
  • 16,929
  • 16
  • 85
  • 141

1 Answers1

2

Before C++11 enum values were unscoped, meaning, that values in 2 enums can't be same. This is no longer the case when using enum class.

Mr M.
  • 715
  • 1
  • 8
  • 24