Hello,
I am trying to define and work with an “enum” class as I used to do in c++ but there is a problem when I use it in a CLR console application. My code is:
________________________________________________________________________
enum colors_t {black, blue, green, cyan, red, purple, yellow, white};
colors_t mycolor;
mycolor = black;
________________________________________________________________________
and I've got the next errors:
1>f:\c++projects\wholedemocontrol\newClasses.h(91) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\c++projects\wholedemocontrol\newClasses.h(91) : error C2371: 'mycolor' : redefinition; different basic types
// compile with: /clr
enumclass day {sun, mon, tue, wed, thu, fri, sat};
enum {sun, mon, tue, wed, thu, fri, sat} day2; // unnamed std enum
int main() {
day a = day::sun;
day2 = sun;
if ((int)a == day2)
// or...
// if (a == (day)day2)
System::Console::WriteLine("a and day2 are the same");
else
System::Console::WriteLine("a and day2 are not the same");
}