Re: +poseAsClass and instance variables
Re: +poseAsClass and instance variables
- Subject: Re: +poseAsClass and instance variables
- From: Darrin Filer <email@hidden>
- Date: Fri, 22 Feb 2002 12:41:00 -0500
Is there anyway around the limitation that classes can't have instance
variables when posing as another class? For my purposes, categories
aren't suitable since I need to ensure that certain methods are
overridden.
You can override methods in categories, just not easily use the
original implementation. But on the over side, you cannot add instance
variables in categories either.
One solution is to store your additional variables in a (static)
NSDictionary, using the instance pointer as the key.
Thanks... Although I'm still looking for a technique with very little
overhead.
Explanation:
I'm using posesAsClass to replace normal NSWindows with ones that are
visual quite different. Most of the instance variables will be used
while drawing during live window resizing. Hence, optimization is sorely
needed. Dictionary lookup is nicely optimized but its still a noticeable
hit when compared to merely accessing an object's value. (right?)
darrin filer
_______________________________________________
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.