Jac*_*kzz 3 c++ enums struct switch-statement
我有一个头文件中定义enum的成员structure.例如,
struct abc{
enum xyz{
FIRST =1;
SEC =2;
}qw;
};
Run Code Online (Sandbox Code Playgroud)
在我的.cpp文件中,我已经包含了这个标题.我有一个switch case在我的文件中,这些enums将被用作case constants.
struct abc az;
switch(az.qw){
case FIRST:....
case SEC:...
default:..
}
Run Code Online (Sandbox Code Playgroud)
但我得到错误FIRST is not declared in this scope.如何克服这个问题.