A delegate is a way to modify the behavior of a class without requiring the class to be subclassed. Often you don't want to dramatically change behavior, but tweak it a bit; subclassing would be overkill, so that's where delegates come in to play.
Look at it this way: a teenager represents a class, and her parent the delegate. The teenager's friend calls her to come hang out at the mall, but the teenager has to ask her parents if it's okay first. The parent -- the delegate -- can say yes or no. That's how delegates work in Cocoa.
Is there any types in it?
Delegates can generally be of any type. In 10.6, many delegates implement protocols with optional methods, so you'll see types like id <BlahClassDelegate>
, but that wasn't common before 10.6.