2 Adding objective-C tag
| link
source | link

Adhering to a protocol and being a subclass at the same time?

In objective C, I have a situation where I would like to have an abstract protocol (interface) with 5 methods and 4 properties, but at the same time, I'd like to have a common implementation of 3 of those 5 methods.

So my question is, is it ok to

1) have just an interface declaration with all the method and property declarations,

2) have a base class that adheres to that protocol (implements that interface) but also provides a common implementation of some of those classes, and only has empty stub method implementations for the rest of the methods, and then finally,

3) have a bunch of subclasses (from that base class), that will conform to that protocol - but - also inherit common method implementations -and - implement on their own those stub methods?