Re: About "[super dealloc];"
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