Re: init and dealloc
Re: init and dealloc
- Subject: Re: init and dealloc
- From: marquis logan <email@hidden>
- Date: Thu, 29 Jan 2004 18:11:58 -0500
- Smtp-relay: netherworld.apago.com
you should release or autorelease self if you decide to return nil.
On Jan 29, 2004, at 5:09 PM, Lorenzo wrote:
Hi,
I init a subclass of NSObject this way:
- (id)initWithData:(NSData*)theData sender:(id)sender
{
self = [super init];
if(!self) return nil;
if(![self checkData:theData]) return nil;
owner = sender;
return self;
}
Now, if I return "nil" because of checkData returns NO,
what should I write to the dealloc method? This?
- (void)dealloc
{
[super dealloc];
}
Also, I use all the time the trick of the "sender" when I init some
object,
so, from the object, I can call the creator of the object. Is this the
correct procedure or is there a better way to get the creator of the
object?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.