Can someone tell me the meaning of the category name when creating the category?
I know that the compiler uses this to identify and map implementations to interfaces. Is there any other use for this?
What if we create 2 categories with different names, implementing the same method in two different ways. Example:
@interface NSString(Good) - (BOOL)isGood; @end @implementation NSString(Good) - (BOOL)isGood { return TRUE; } @end @interface NSString(Bad) - (BOOL)isGood; @end @implementation NSString(Bad) - (BOOL)isGood { return FALSE; } @end
And now in the program I create a line
NSString *goodString = @"GOOD";
I got the output [goodString isGood] as false.
I want to know why and how the category name is involved in this?
Gokul source share