• 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: NSProxy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSProxy


  • Subject: Re: NSProxy
  • From: Brent Gulanowski <email@hidden>
  • Date: Wed, 15 Jan 2003 12:08:22 -0500

On Tuesday, January 14, 2003, at 03:03 PM, The Amazing Llama wrote:

Going about my only idea for finding this memory leak (as mentioned in NSZombie, the other thread I just started), I'm implementing a class that pretends to be an NSNumber.

I figured that I should subclass from NSProxy. Then I looked at NSProxy and realized that it gave me no features at all, and as far as I can tell just makes my life interesting by selectively not implementing a few things; -init for example. So... what's the point of subclassing NSProxy? What DOES it give you, aside from bookkeeping?

NSProxy is used for interprocess communication, to represent a receiver object in another task. See "Remote Messaging" in Inside Mac OS X: Object Oriented Programming and the Objective-C Language. If you want to imitate an existing class, I believe what you want is

+ (void) poseAsClass: (Class) aClass
Causes the receiving class to "pose as" its aClass superclass. The receiver takes the place of aClass in the inheritance hierarchy; all messages sent to aClass will actually be delivered to the receiver. The receiver must be defined as a subclass of aClass . It can't declare any new instance variables of its own, but it can define new methods and override methods defined in aClass . The poseAsClass: message should be sent before any messages are sent to aClass and before any instances of aClass are created.

See "http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSObject.html#//apple_ref/occ/clm/NSObject/ poseAsClass:"

Because NSNumber is a class cluster, there might be complications, but I don't know.

Brent Gulanowski
--
Mac game development news and discussion
http://www.idevgames.com
_______________________________________________
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.

References: 
 >NSProxy (From: The Amazing Llama <email@hidden>)

  • Prev by Date: Re: OpenGL printing/image
  • Next by Date: Re: NSZombies
  • Previous by thread: Re: NSProxy
  • Next by thread: Quick NSWorkspace question
  • Index(es):
    • Date
    • Thread