Reputation: 9437
Suppose I have a parent class that implements a protocol:
@interface GameViewController : UIViewController<GamePrizeDelegate> {
...
}
And then I make subclasses of it:
@interface TennisViewController : GameViewController {
...
}
@interface SoccerViewController : GameViewController {
...
}
Do I have to include the GamePrizeDelegate
also in the subclasses? Are the protocols inherited as well?
Thanks!
Upvotes: 22
Views: 2225
Reputation: 47231
Referring to Apple's documentation: Your subclass does inherit the adoption of the protocol, so you don't have to adopt it again.
A class is said to conform to a formal protocol if it adopts the protocol or inherits from another class that adopts it. An instance of a class is said to conform to the same set of protocols its class conforms to.
Upvotes: 29