-(void)dealloc - How ? Objective - C

Posted by sagar on Stack Overflow See other posts from Stack Overflow or by sagar
Published on 2010-04-27T09:50:16Z Indexed on 2010/04/27 9:53 UTC
Read the original article Hit count: 300

Please Note that - this is not similar than this question.

OK. To understand my question, First of all please see both of these destructors.

- (void)dealloc {
    [Marketdetails release]; Marketdetails=nil;
    [parsedarray release]; parsedarray=nil;
    [Marketid release]; Marketid=nil;
    [marketname release]; marketname=nil;
    [super dealloc];
}

- (void)dealloc {
    [super dealloc];
    [Marketdetails release]; Marketdetails=nil;
    [parsedarray release]; parsedarray=nil;
    [Marketid release]; Marketid=nil;
    [marketname release]; marketname=nil;
}

See, Both destructors have different code.

  • In First Destructor first current class objects are released & then [super dealloc] is called.
  • In second Desctructor first [super dealloc] is called.

My question is as follows.

  • Where should we write [super dealloc] ? first or last ? or it doesn't matter ?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c