Protocols and Delegates

suggest change

Remarks

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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents