jeudi 19 février 2015

Use enum defined in a struct as case constatnt in C++


Vote count:

0




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 constatnts.



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.



asked 1 min ago







Use enum defined in a struct as case constatnt in C++

Aucun commentaire:

Enregistrer un commentaire