Use enum defined in a struct as case constant in C++
c++, enums, struct, switch-statement
Solution
`xyz` is defined in the scope of `abc`, so you need
case abc::FIRST:
etc.
Problem
I have an `enum` as a member of a `structure` defined in a header file. For example, ``` struct abc{ enum xyz{ FIRST =1; SEC =2; }qw; }; ``` In my `.cpp` file , I have included this header. I have a `switch case` in my file where these `enums` are to be used as `case constants`. ``` struct abc az; switch(az.qw){ case FIRST:.... case SEC:... default:.. } ``` But I get error as `FIRST is not declared in this scope`. How to overcome the problem.