Protocols and Delegates
suggest changeRemarks
Protocols and delegates are related, but they are different concepts.
A protocol is an interface a class can conform to, meaning the class implements the listed methods.
A delegate is typically an object (often otherwise anonymous to the caller) that conforms to a protocol.
Using a delegate is the delegation design pattern.
Inheritance creates a tight coupling between a subclass and its superclass. Delegation is an alternative: a looser relationship with a separate delegate object.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents