Overriding Delegate Methods when subclassing in Cocoa

cocoa-touch, delegates, objective-c

Solution

Should I declare them in the subclass header again?

That won't be necessary, as your `Bar.h` will import `Foo.h` and therefore know it conforms that protocol.

When I implement these 3 methods inside of Bar's delegate, do I have to take any precautions to make sure Foo's implementation will not be used?

The only precaution you need to take is to not call `[super delegateMethod];` on your implementations, and you're good to go.

Problem

Suppose I have a class `Foo` which declares a delegate protocol with 3 methods. I would like to subclass `Foo` into a class called `Bar` and completely override these methods. Should I declare them in the subclass header again? When I implement these 3 methods inside of `Bar`'s delegate, do I have to take any precautions to make sure `Foo`'s implementation will not be used?

Original source