Possible Duplicate:
Difference between self.ivar and ivar?
Let's say I have the following class
@interface
@property ( nonatomic, retain ) MyObject* property;
@end
@implementation
@synthesize property = _property;
-(id) init{
if ((self = [super init])) {
_property = [MyObject new];
self.property = [MyObject new];
NSLog(@"%@", _property.description);
NSLog(@"%@", self.property.description);
}
return self;
}
@end
What is the correct way? using accessors (synthesize: self.property) or using the ivar directly? It's just that i have sometimes felt that using the accessors caused in errors when I try to use them in other files.