I am finally getting the hang of enum lists, but am now getting the following warnings on my code:
warning C4482: nonstandard extension used: enum 'Dialog::Type' used in qualified name |
The code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
class Dialog
{
//...
public:
enum Type
{
Horizon,
Error
};
};
Dialog::Dialog(Canvas* parent, int type, Qt::WindowFlags f) : QDialog(parent,f)
{
Value.reserve(20);
this->setLayout(&Layout);
dialog_type = type;
switch(dialog_type)
{
case Type::Horizon:
//...
break;
default:
break;
}
}
|
The warnings arise in the
case Type::Horizon:
statement. I've tried it with
Dialog::Type::Horizon
instead, but that doesn't stop the warning either.
I just don't really understand what it means.
Last edited on
Oh. That's weird. Solves it, so thanks, but... weird.
Just as a curiosity, what if the class has two enum's?
This fails to compile:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
using namespace std;
class MyClass
{
enum E1
{
alpha,beta
};
enum E2
{
alpha,beta
};
};
int main()
{
return 0;
}
|
That's what I get:
C:\Program Files\CodeBlocks\my_projects\cplusplus\quiz.cpp|13|error: declaration of `alpha'|
C:\Program Files\CodeBlocks\my_projects\cplusplus\quiz.cpp|8|error: conflicts with previous declaration `MyClass::E1 MyClass::alpha'|
C:\Program Files\CodeBlocks\my_projects\cplusplus\quiz.cpp|14|error: declaration of `beta'|
C:\Program Files\CodeBlocks\my_projects\cplusplus\quiz.cpp|9|error: conflicts with previous declaration `MyClass::E1 MyClass::beta'|
||=== Build finished: 4 errors, 0 warnings ===| |
Last edited on