1 | #import <objc/NSObject.h> |
2 | #include <stdio.h> |
3 | |
4 | struct Structure { |
5 | int m_field; |
6 | void fun() { |
7 | puts(s: "check this\n" ); |
8 | } |
9 | }; |
10 | |
11 | @interface Classic : NSObject { |
12 | @public |
13 | int _ivar; |
14 | } |
15 | @end |
16 | |
17 | @implementation Classic |
18 | - (void)fun { |
19 | puts(s: "check self\n" ); |
20 | } |
21 | @end |
22 | |
23 | int main() { |
24 | Structure s; |
25 | s.m_field = 41; |
26 | s.fun(); |
27 | |
28 | Classic *c = [Classic new]; |
29 | c->_ivar = 30; |
30 | [c fun]; |
31 | |
32 | Classic *self = c; |
33 | puts(s: "check explicit self\n" ); |
34 | (void)self; |
35 | } |
36 | |