Skip navigation.
 
mlnewbie NSMutable dictionary subclass question
FROM : Bob Sabiston
DATE : Mon Nov 17 01:25:08 2008

Can the value part of a key-value pair in an NSMutableDictionary be a 
literal NSString, like @"name"?

It would seem so, because this works or at least doesn't crash:

   NSMutableDictionary *bobo;
   bobo = [[NSMutableDictionary alloc] init];
   [bobo setValue:@"root" forKey:@"name"];


However, I have a class derived from NSMutableDictionary, and it is 
crashing when I try to do the same thing:


@interface myClass : NSMutableDictionary {
}
@end

myClass *tree;
tree = [[myClass alloc] init];
[tree setValue:@"root" forKey:@"name"];


Why does that crash when the first does not?  Are subclasses required 
to have member variables, or can they just have new functions?  Mine 
don't have any variables, maybe that is the problem?

Thanks for any replies!
Bob

Related mailsAuthorDate
mlnewbie NSMutable dictionary subclass question Bob Sabiston Nov 17, 01:25
mlRe: newbie NSMutable dictionary subclass question Chris Suter Nov 17, 01:50
mlRe: newbie NSMutable dictionary subclass question Mike Abdullah Nov 17, 11:16
mlRe: newbie NSMutable dictionary subclass question Jean-Daniel Dupas Nov 17, 11:38