How do I use the Enum value from a class in another part of code?

Use

core.gameMode = Core::INIT;

The individual values of an enumeration are scoped not within that enumeration but at the same level as the enumeration itself. This is something that most other languages (including C#) do differently, and C++0x will allow both variants so that there,

core.gameMode = Core::GAME_MODE::INIT;

will also be legal.

In addition, the strongly typed enums that will be added in C++0x (enum class) will put the enum values only within the scope of the enum (i.e. as in C#); this solves the problem you noted in your comment that for “normal” enums, the identifiers for enum values need to be unique across all enums defined in the same scope.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)