- 重载
黑魔法: attribute((overloadable))
<pre>
@interface ViewController ()
@end
NSString * attribute((overloadable)) mytest(NSString *x) {return @"aa";}
NSString * attribute((overloadable)) mytest(NSNumber *x) {return @"bb";}
NSString * attribute((overloadable)) mytest(NSDictionary *x) {return @"cc";}
NSString * attribute((overloadable)) mytest(int x) { return @"int"; }
NSString * attribute((overloadable)) mytest(double x) { return @"double"; }
NSString * attribute((overloadable)) mytest(long x) { return @"long"; }
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"%@", mytest(133333333));
}
@end
</pre>