【发布时间】:2012-09-15 10:45:44
【问题描述】:
我已经声明了一个枚举如下:
enum fileType {typeA, typeB};
当我尝试将 directoryType 类型附加到字符串时,这会导致错误。 我相信我需要在枚举声明中包含枚举标识符的基础类型。或者类似的东西
enum fileType : string {typeA, typeB};
如http://msdn.microsoft.com/en-us/library/2dzy4k6e(v=vs.80).aspx中所述
但是这不是为我编译的。声明枚举标识符的底层类型的正确语法是什么?
【问题讨论】:
-
在您的链接中
This can be any scalar type, such as signed or unsigned versions of int, short, or long. bool or char is also allowed.您不能使用String或其他任何内容。
标签: c++ types enums enum-class