• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Delegates -- WHAT is delegated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delegates -- WHAT is delegated?


  • Subject: Re: Delegates -- WHAT is delegated?
  • From: leenoori <email@hidden>
  • Date: Sat, 23 Dec 2006 17:17:39 +0100

El 23/12/2006, a las 16:38, William Squires escribió:

Cocoa objects that support delegates tend to implement delegation to mean "When certain events happen, check to see if the delegate implements a specific method selector. If it does, perform that selector on the delegate object to give it a chance to respond to the event".

This sounds like a more complicated version of RB's event model, wherein you can make a "New Event" in a class so that subclasses will get that event (if they want to code it), or ignore it (by putting no code in it) in which case it'll be available to any subclass of that subclass. Is this similar?

No because the whole point of delegates is that they enable you to customize (or influence, or override) the behaviour of an object without having to write a subclass. Any object at all can be a delegate.


Of course, Objective-C also offers the possibility of subclassing, but for many things delegates work out to be simpler and/or better.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Delegates -- WHAT is delegated? (From: Sam Colombo <email@hidden>)
 >Re: Delegates -- WHAT is delegated? (From: Nat Lanza <email@hidden>)
 >Re: Delegates -- WHAT is delegated? (From: William Squires <email@hidden>)

  • Prev by Date: Layers and transparency Core Image
  • Next by Date: NSImage/BitmapRep behavior
  • Previous by thread: Re: Delegates -- WHAT is delegated?
  • Next by thread: Re: Delegates -- WHAT is delegated?
  • Index(es):
    • Date
    • Thread