int main( int argc, char* argv[] )
{
enum{ x = 20 } ; // x is equivalent to a literal int
// auto px = &x ; // *** error, x is not an lvalue
constint y = 30 ; // y is not modifiable;
// here, it is a constant whose value is known at compile time
auto py = &y ; // fine, y is an lvalue
constint y1 = argc ; // y1 is not modifiable;
// here, it is a not constant whose value is known at compile time
auto py1 = &y1 ; // fine, y1 is an lvalue
constexprint z = 30 ; // z is a constant whose value must be known at compile time
auto pz = &z ; // fine, z is an lvalue
}
Any object of an unscoped enumeration can be implicitly converted to an integer type. However an object of an integer type may not be directly assigned to an object of unscoped enumeration. For example
enum Number {x=20,y=30,z=40};
Number n = x;
int v = n; // O'k: v = 20
n = v; // error: may not assign v to n
n = static_cast<Number>( v ); // O'k
Also you may overload operators for enumeration types.