Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclass of NSMutableDictionary hanging



OK, so it seems like you can't (simply) subclass some NSxxx data objects... why is that? I have successfully subclassed some GUI NSxxx objects with no problems.

In this situation I can very easily just have my own object wrapper that contains and maintains an nsdictionary - but I'm still interested as to why normal subclassing doesn't work like it does in other OO languages. From reading this page:

http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/CocoaObjects/chapter_3_section_9.html

I am pretty lost as to why you have to add all of the seemingly redundant "glue code" for all of the primitive methods. Can you just write all of the primitive methods as:

- (void)someMethod:(NSObject *)x
{
	[super someMethod:x];
}

Or am I missing something? {scratches head...}



On 04/03/2007, at 7:26 AM, Jerry Krinock wrote:
on 07/03/03 10:10, Keary Suska at email@hidden wrote:

If your member count is large or varies significantly you could have a
custom object that maintains a dictionary and override the KVC
-valueForUndefinedKey methods in your object for transparent access to the
dictionary.


Yes, this is a cool trick; think of it as a "thin wrapper" around NSMutable
Dictionary. It's quite easy to convert an existing NSMutableDictionary into
one of these.




_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Subclass of NSMutableDictionary hanging (From: Jerry Krinock <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.