If two different Categories having same method, then which one will be invoked by objective C runtime system ??
for example:
@interface ClassA (MathOps)
-(void)CategoryMethod;
@end
@interface ClassA (MathOps1)
-(void)CategoryMethod;
@end
@implementation ClassA(MathOps1)
- (void) CategoryMethod{
NSLog(@"Inside Category Method 2");
}
@end
@implementation ClassA(MathOps)
- (void) CategoryMethod{
NSLog(@"Inside Category Method 1");
}
@end
Now if i am calling, [ObjClassA CategoryMethod];, Then which one called ? Why ?
It's undefined. It depends on which category gets loaded first by the runtime, are there's no documented order in which that happens.
Bottom line: don't do this. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With