In subclassing a class, I want to also subclass a delegate of the parent class given that the subclass now has additional functionality. What\'s the best way to go about doing
Follow the example of NSTableView
and NSOutlineView
.
NSOutlineView
is a subclass of NSTableView, and defines its own protocol for its dataSource
and delegate
.
NSTableView
declares its delegate this way:
- (void)setDelegate:(id )delegate;
- (id )delegate;
and NSOutlineView
:
- (void)setDelegate:(id )anObject;
- (id )delegate;
Apparently the compiler is more lenient with bare method declarations than it is with property declarations.
Unlike NSTable/OutlineView, you might want to make the subclass's protocol inherit from the base class's protocol, e.g.
@protocol SpecializedProtocol
... it probably depends on the situation.