Does a class need to implement all of the methods in a protocol?
No. Starting with Objective-C 2.0, protocols can include the keywords @required and @optional, indicating whether a conforming object must or could supply an implementation of a method. If no keyword is specified, the method is required. The required/optional property takes effect until the next time one of the keywords appears, or the @end of the protocol definition.
Related Questions
- A class inherits from 2 interfaces and both the interfaces have the same method name as shown below. How should the class implement the drive method for both Car and Bus interface?
- Will USNAP have to reinvent each device class as ZigBee & other protocol standards have already done?
- Does a class need to implement all of the methods in a protocol?