New to OC, many years of C, C++, C#, mind is kind of boggled now.
Given:
// AnInterface.h
@interface AnInterface : NSObject
{
}
@property (retain) SomeObject* m_Object;
// AnInterface.m
#import "AnInterface.h"
@synthesize m_Object;
-init
{
self= [super init];
if(!self)
return (nil);
SomeObject* pObject= [[SomeObject alloc] init];
self.m_Object= pObject;
[pObject release];
}
I am pretty sure the above is correct. However, why not just do:
self.m_Object= [[SomeObject alloc] init];
Does that work as well? Is it in violation of some memory management tenet? It seems like it should work, one line rather than three, but I am certain I must be missing something....
Any insight would be appreciated.