• 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: About "[super dealloc];"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About "[super dealloc];"


  • Subject: Re: About "[super dealloc];"
  • From: Jelle De Laender <email@hidden>
  • Date: Mon, 1 Jun 2009 14:03:37 +0200

You need to call [super dealloc] when you want to call the dealloc method of the super of your class. (logical, isn't?).

Every class has default the next dealloc method:

-(void)dealloc {
	[super dealloc];
}

But, when you want to release classes you have initialised in your object, you need to do this in the dealloc method, so you need to overwrite the dealloc method, add your releases and call the dealloc of the super (to keep the chain).

See http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html for the real method.

Jelle

On 01 Jun 2009, at 13:52, Bright wrote:

Hi ,all
In Cocoa, if there is "[super init];", there will be "[super dealloc];" correspondently at the end of this class.
But I find that sometimes if there is not "[super init];", there will be "[super dealloc];" correspondently too.
I puzzled. When should use the "[super dealloc];"? Could anyone list all of case.



Bright

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >About "[super dealloc];" (From: Bright <email@hidden>)

  • Prev by Date: Re: About "[super dealloc];"
  • Next by Date: Re: NSXMLParser - howto resolve entities defined in DTD
  • Previous by thread: Re: About "[super dealloc];"
  • Next by thread: Re: NSXMLParser - howto resolve entities defined in DTD
  • Index(es):
    • Date
    • Thread