⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formal_protocol-3.m

📁 this is a gcc file, you can download it and learn its usetility, for further detail please look at t
💻 M
字号:
/* Contributed by Nicola Pero - Fri Mar  9 21:35:47 CET 2001 */#include <objc/objc.h>#include <objc/Object.h>/* Test defining two protocol, a class adopting both of them,    and using an object of type `id <Protocol1, Protocol2>' */ @protocol Enabling- (BOOL) isEnabled;- (void) setEnabled: (BOOL)flag;@end@protocol Evaluating- (int) importance;@end@interface Feature : Object <Enabling, Evaluating>{  const char *name;  BOOL isEnabled;}@end@implementation Feature- (BOOL) isEnabled{  return isEnabled;}- (void) setEnabled: (BOOL)flag{  isEnabled = flag;}- (int) importance{  return 1000;}@endint main (void){  id <Enabling, Evaluating> object;  object = [Feature new];  [object setEnabled: YES];  if (![object isEnabled])    {      abort ();    }  if ([object importance] != 1000)    {      abort ();    }  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -