I'm running into some trouble implementing a simple super/sub class scheme. I declare an NSMutableDictionary in the superclass, and am trying to access it in a subclass, but it only returns null. Any help would be appreciated.
@interface RootModel : NSObject <Updatable, TouchDelegate>
@property (nonatomic) NSMutableDictionary *gameValues;
@end
@interface SubclassModel : RootModel
@end
@implementation RootModel
- (id)initWithController:(id)controller {
if ((self = [super init])) {
_controller = controller;
_gameValues = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:300.0f], KEY_JUMP_VELOCITY,
[NSNumber numberWithFloat:49.47f], KEY_GRAVITY,
[NSNumber numberWithFloat:0.25f], KEY_JUMP_TIME_LIMIT,
nil];
NSLog(@"%@", _gameValues);
}
return self;
}
@implementation SubclassModel
- (id)init{
if ((self = [super init])) {
// This NSLog prints "(null)" if using super.gameValues or self.gameValues, why?
NSLog(@"subclass: %@", super.gameValues);
}
return self;
}
@end
What am I doing wrong?