super-class-3.m

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· M 代码 · 共 44 行

M
44
字号
/* Ensure that the compiler does not emit spurious extern declarations named '_Foo', where 'Foo'   is an ObjC class name.  *//* Contributed by Ziemowit Laski <zlaski@apple.com>.  *//* { dg-do run } */#include <objc/Object.h>#include <stdlib.h>#define CHECK_IF(expr) if(!(expr)) abort()@interface _Child: Object+ (int) flashCache;@end@interface Child: _Child+ (int) flushCache1;@end@interface Child (Categ)+ (int) flushCache2;@endint _Object = 23;  /* Should not conflict with @interface Object.  */@implementation _Child+ (int) flashCache { return 12 + _Object; }@end@implementation Child+ (int) flushCache1 { return 7 + [super flashCache]; }@end@implementation Child (Categ)+ (int) flushCache2 { return 9 + [super flashCache]; }@endint main(void) {  CHECK_IF([_Child flashCache] == 35);  CHECK_IF([Child flushCache1] == 42);  CHECK_IF([Child flushCache2] == 44);  return 0; }

⌨️ 快捷键说明

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