View difference between Paste ID: ZLAtAfXd and TT1hPEzn
SHOW: | | - or go back to the newest paste.
1
#include <Foundation/Foundation.h>
2
#include <objc/message.h>
3
#include <stdio.h>
4-
#if !defined(OBJC_ROOT_CLASS)
4+
5-
#   if __has_attribute(objc_root_class)
5+
6-
#       define OBJC_ROOT_CLASS __attribute__((objc_root_class))
6+
7-
#   else
7+
@interface TestClass: NSObject
8-
#       define OBJC_ROOT_CLASS
8+
9-
#   endif
9+
    NSInteger pageNum;
10-
#endif
10+
11
12
@property NSInteger pageNum;
13-
@interface TestClass
13+
14
@end
15-
+(void) testMethod;
15+
16
int main()
17
{
18
    /*Class cls = objc_getClass("TestClass");
19-
@implementation TestClass
19+
20
    
21-
+(void) testMethod
21+
22
    
23-
    printf("testMethod\n");
23+
    TestClass* test = [TestClass alloc];
24
    
25
    [test setPageNum: 10];
26
    
27
    printf("%ld\n", (long)test.pageNum);
28
    
29
    return 0;
30
}