Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
By default, the underlying type of an enumeration is int. However, you can specify the type to be signed or unsigned forms of int, short, long, __int32, or __int64. You can also use char.
Example
Code
// mcppv2_enum_3.cpp
// compile with: /clr
public enum class day_char : char {sun, mon, tue, wed, thu, fri, sat};
int main() {
// fully qualified names, enumerator not injected into scope
day_char d = day_char::sun, e = day_char::mon;
System::Console::WriteLine(d);
char f = (char)d;
System::Console::WriteLine(f);
f = (char)e;
System::Console::WriteLine(f);
e = day_char::tue;
f = (char)e;
System::Console::WriteLine(f);
}
Output
sun
0
1
2