formal_protocol-7.m
来自「gcc-you can use this code to learn somet」· M 代码 · 共 45 行
M
45 行
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */#include <objc/objc.h>#include <objc/Object.h>#include <objc/Protocol.h>/* Test defining two protocols, one incorporating the other one. */@protocol Configuring- (void) configure;@end@protocol Processing <Configuring>- (void) process;@end/* A class adopting the protocol */@interface Test : Object <Processing>{ BOOL didConfigure; BOOL didProcess;}@end@implementation Test- (void) configure{ didConfigure = YES;}- (void) process{ didProcess = YES;}@endint main (void){ id <Processing> object = [Test new]; [object configure]; [object process]; return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?