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

Re: Subclassing NSDictionary...


  • Subject: Re: Subclassing NSDictionary...
  • From: Andreas Schwarz <email@hidden>
  • Date: Sat, 27 Apr 2002 11:56:11 -0700

Hopefully, this will be a quick answer by someone. I am trying to subclass
NSMutableDictionary as follows (....)

I'm a little late into the game here, but I was surprised to note nobody pointed out the obvious. There doesn't seem to be any need to subclass in this case (at least based on the code given). It would do fine as a category. (I'm a relative newbie to Objective-C and categories still amaze me, they're so useful :-).

@interface NSMutableDictionary (SomeExtraStuff)
-(void) setSomeValue:(NSString *)theValue;
@end

@implementation NSMutableDictionary (SomeExtraStuff)
- (void) setSomeValue:(NSString *)theString
{
[self setObject:theString forKey:@"key"];
}
@end


Andreas Schwarz
http://homepage.mac.com/schwarz
_______________________________________________
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: Localizable.strings weirdness
  • Next by Date: RegEx in cocoa, and where to dl PB+IB?
  • Previous by thread: Re: Subclassing NSDictionary...
  • Next by thread: newbie - XML Services
  • Index(es):
    • Date
    • Thread