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 };
};

?

1
  • You don't need to put it inside of a struct to produce this ambiguity. Commented Mar 30, 2015 at 11:39

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.