我在某个库中找到了表达式enum-type-name(integral-value),但它看起来有点奇怪,它真的是它的样子(至少对我而言)?枚举类型可以作为函数调用,还是只是另一种类型的转换枚举?或者是什么?例如:
enum SomeEnum
{
SOMETHING = 0,
OTHERTHING = 1
};
void someFunction(SomeEnum e)
{
// ...
}
someFunction( 2 ); // Invalid conversion
someFunction( (SomeEnum)2 ); // Works, Normal casting
someFunction( SomeEnum(2) ); // Works!! calling the enum as a function?? or just another style of enum casting??
Run Code Online (Sandbox Code Playgroud)