+ 1

Differences between enum and enum class and typedef enum

Hi, I would like to know the differences between declaring an enum variable using these 3 types of declaration: enum, enum class, typedef enum.

15th Oct 2024, 11:09 AM
Mick
Mick - avatar
2 Answers
0
typedef enum is for C, in C++ we don't do it. enum {} is the same thing as having many global variables. GAMEOVER enum class className {} means they will be local to their className scope. For example className::GAMEOVER Even you can declare enum by their data type enum: unsigned long long {} enum class cn: uint_16 {}
16th Oct 2024, 9:01 AM
Sharpneli
Sharpneli - avatar
0
I read that members of unscoped enumerators (enum Enum_{}) cannot be obtained with scope resolution operator (::), but I found that this is not the case. Why?
16th Oct 2024, 10:36 AM
Mick
Mick - avatar