• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: init and dealloc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >init and dealloc (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: "check spelling as you type" persistence
  • Next by Date: Re: Problem with CircleView Example and NSLayoutManager angles...
  • Previous by thread: init and dealloc
  • Next by thread: Re: init and dealloc
  • Index(es):
    • Date
    • Thread