Are protocols inherited in Objective-C?

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 inherited. If I am right, then there is no need to enter <NSCopying, NSMutableCopying>again after " NSMutableCharacterSet : NSCharacterSet". And NSMutableCharacterSet also conforms to NSCoding protocol, right?

How do I recruit Apple again? Am I mistaken?

+3
source share
1 answer

Yes. Subclasses will also apply the same protocols.

The reason Apple is dialing this again is because NSMutableCharacterSet has overridden -copyWithZone:and -mutableCopyWithZone:.

+8
source

Source: https://habr.com/ru/post/1748467/


All Articles