5 #include <objc/runtime.h>
7 @interface Super1 : TestRoot @end
9 +(int)classMethod { return 1; }
10 -(int)instanceMethod { return 10000; }
13 @interface Super2 : TestRoot @end
14 @implementation Super2
15 +(int)classMethod { return 2; }
16 -(int)instanceMethod { return 20000; }
19 @interface Sub : Super1 @end
21 +(int)classMethod { return [super classMethod] + 100; }
22 -(int)instanceMethod {
23 return [super instanceMethod] + 1000000;
32 testassert(101 == [[Sub class] classMethod]);
33 testassert(1010000 == [obj instanceMethod]);
35 cls = class_setSuperclass([Sub class], [Super2 class]);
37 testassert(cls == [Super1 class]);
38 testassert(object_getClass(cls) == object_getClass([Super1 class]));
40 testassert(102 == [[Sub class] classMethod]);
41 testassert(1020000 == [obj instanceMethod]);