标签:
1 #import <Foundation/Foundation.h> 2 3 @interface Person : NSObject 4 - (void) test; 5 - (void) test:(int) ab; 6 + (void) test; 7 8 @end 9 10 11 @implementation Person 12 - (void) test 13 { 14 NSLog(@"调用了对象方法test"); 15 } 16 17 - (void) test:(int) a 18 { 19 NSLog(@"%d", a); 20 } 21 22 + (void) test 23 { 24 NSLog(@"调用了类方法test"); 25 } 26 27 @end 28 29 30 int main() 31 { 32 [Person test]; 33 34 Person *p = [Person new]; 35 [p test]; 36 [p test:22]; 37 return 0; 38 }
[Objective-c 基础 - 2.2] OC弱语法、类方法
标签:
原文地址:http://www.cnblogs.com/wvqusrtg/p/4501498.html