Reputation: 1453
I saw this in some header file in the framework directory:
@interface NSCharacterSet : NSObject <NSCopying, NSMutableCopying, NSCoding>
@end
@interface NSMutableCharacterSet : NSCharacterSet <NSCopying, NSMutableCopying>
@end
I thought protocols were inheritable.If I am right about that,There is no need to type <NSCopying, NSMutableCopying>
again after "NSMutableCharacterSet : NSCharacterSet
".And NSMutableCharacterSet also conforms to NSCoding protocol, right?
Than why is Apple typing that again?Am I making mistake?
Upvotes: 3
Views: 175
Reputation: 523684
Yes. Subclasses will adopt the same protocols as well.
The reason Apple typing that again is because NSMutableCharacterSet has overridden -copyWithZone:
and -mutableCopyWithZone:
.
Upvotes: 8