下面是我在球类的头文件中创建的枚举:错误时枚举值
typedef enum {
redBall = 0,
blueBall = 1,
greenBall = 2
}ballTypes;
和接口:
ballTypes ballType;
在Ball.mm的init方法我初始化ballType如下:
ballType = 0;
我得到以下错误:
Assigning to 'ballTypes' from incompatible type 'int'
我该如何解决这个问题?
可能重复http://stackoverflow.com/questions/707512/what-is-a-typedef-enum-in-objective-c?rq=1 – voromax
@voromax它可以是相关的,甚至可能是重复的,但不是一个确切的复制... – fotanus