• 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: Are polymorphic objects possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Are polymorphic objects possible?


  • Subject: Re: Are polymorphic objects possible?
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 2 Nov 2002 01:03:55 -0600

At 5:37 PM +1100 11/2/02, Wade Tregaskis wrote:
Is it possible for an object to change at runtime what it appears to be, to the rest of the program?

Yes[1]. After all, objects are just responding to messages. You can respond to arbitrary messages by overriding -[NSObject methodSignatureForSelector:] and [NSObject -forwardInvocation:].

This is essentially how NSProxy/NSDistantObject works. See the documentation for -[NSObject forwardInvocation:] for more details.

-- Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Are polymorphic objects possible?
  • Next by Date: Re: Cocoa really needs to be thread-safe (Dave Rehring)
  • Previous by thread: Re: Are polymorphic objects possible?
  • Next by thread: Re: Are polymorphic objects possible?
  • Index(es):
    • Date
    • Thread