
//定义方法
typedef enum:NSInteger{ //typedef大括号后的名称(authority)取代enum ,冒号后的类型定义的是枚举变量的类型
kPass = 1; //一般情况下枚举都是整型
kDenied = 0;
}authority
//应用方法 (门禁)
#import <Foundation/Foundation.h>
int main(void){
autoreleasepool{
if(authority){ //authority的kPass整型为1
NSLog(@"open gate");
}else{
NSLog(@"shut gate");
}
}
return 0;
}




by: 发表于:2017-10-13 10:11:47 顶(0) | 踩(0) 回复
??
回复评论