If two different classes have the same method, then which one will be called by the Objective-C runtime system?

If two different classes have the same method, then which one will be called by the target C runtime system

eg:

@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 call, [ObjClassA CategoryMethod] ;, then which one is called? Why?

+5
source share
2 answers

@Dave DeLong, undefined. "", , . - , . . "" . , ( ), , . .

Cocoa, (, Cocoa) , , , . , , , :

@interface NSObject (MyCategory)
- (void)myprefix_categoryMethod;
@end
+4

undefined. , , , .

: .:)

+8

All Articles