I don\'t really have a solid understanding of Setters and Getters for objective-c. Can someone provide a good guide for beginners? I noticed that this comes into play when t
The particular section of interest to you is Declared Properties.
b's interface should look like:
@interface b : NSObject {
NSString *value;
}
@property (nonatomic, retain) NSString *value;
- (id) initWithValue:(NSString *)newValue;
@end
Your implementation of b should look something like:
@implementation b
@synthesize value;
- (id) initWithValue:(NSString *)newValue {
if (self != [super init])
return nil;
self.value = newValue;
return self;
}
@end
Which you could then call like:
b *test = [[b alloc] initWithValue:@"Test!"];
NSLog(@"%@", test.value);
The Getting Started with iOS guide in the iOS Reference Library outlines the reading material you should go through to nail down basics like this. Apple's guides are clearly written and thorough, and you'll be doing yourself a huge favor by hunkering down and just reading them.