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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/maillist%40codingmammoth.com

This email sent to maill...@codingmammoth.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to