标签:import interface ace argc exit tor const sel 客户端
Person.h
#import <Foundation/Foundation.h> @interface Person : NSObject - (Person *(^)())study; - (Person *(^)())run; @end
Person.m
#import "Person.h" @implementation Person - (Person *(^)())study { return ^{ NSLog(@"study"); return self; }; } - (Person *(^)())run { return ^{ NSLog(@"run"); return self; }; } @end
main.m
#import <Foundation/Foundation.h> #import "Person.h" int main(int argc, const char * argv[]) { @autoreleasepool { Person *p = [[Person alloc] init]; p.study().run(); } return 0; }
运行结果:
2016-12-19 22:18:34.247 block的使用[2334:101201] study 2016-12-19 22:18:34.248 block的使用[2334:101201] run Program ended with exit code: 0
标签:import interface ace argc exit tor const sel 客户端
原文地址:http://www.cnblogs.com/yongdaimi/p/6200825.html