【发布时间】:2012-12-24 16:01:59
【问题描述】:
我有一个国际象棋益智游戏。
我想在枚举中设置错误的方块。
enum 1000H1wrong {11, 13, 15 21, 22};
我可以检查一下 ENTIRE 枚举 1000H1 中是否有数字吗?
if chesssquare == enum 1000H1wrong { }
和这个一样:
if ((chesssquare == 11) || (chesssquare == 13) || (chesssquare == 15) || (chesssquare == 21) || (chesssquare == 22)) { }
【问题讨论】:
-
enum是 C 功能,据我所知,没有自动为您提供有用的运行时表示来让您执行此类操作。 -
你不能有一个以数字开头的标识符。这是一个编译错误
标签: objective-c ios macos cocoa enums