开发者

pass specific enum value to method in objective-c

开发者 https://www.devze.com 2022-12-18 20:37 出处:网络
Altough I already know it\'s not possible, as my understanding how programming works, I would like to have a confirmation of this.

Altough I already know it's not possible, as my understanding how programming works, I would like to have a confirmation of this.

I have an enum

typedef enum {
enum_first=1,
enum_second=2
} myenum

I wanted to do overloading of method, this syntax is obviously wrong, but it gives the idea:

-(id)myenumTest:(myenum.enum_first)value {...}

-(id)myenumTest:开发者_如何学运维(myenum.enum_second)value {...}

Can you suggest an alternative way for this ?

thanks Leonardo


I'd use a case statement within the method based on the value of the enum variable.

0

精彩评论

暂无评论...
验证码 换一张
取 消