Re: Dealloc method needed?
Re: Dealloc method needed?
- Subject: Re: Dealloc method needed?
- From: email@hidden
- Date: Tue, 25 Jun 2002 05:47:44 -0500
Of course in your -dealloc routine you should call its super dealloc..
- (void)dealloc
{
[ object release ] ;
...
[ super dealloc ] ; // standard obj-c pattern .. :-)
}
On Tuesday, June 25, 2002, at 02:51 AM, Andy Lee wrote:
At 9:11 AM +0200 6/25/02, Michhle Garoche wrote:
Le mardi 25 juin 2002, ` 08:32 , Nathan Day a icrit :
dealloc is called by the release method when the objects reference
count reaches zero.
Excuse me. My words were not what I meant. I would say should I
implement the release method...?
No. You should *call* -release at appropriate times (generally to
balance calls to -retain), but never override it.
The reverse is true for -dealloc. You should *override* -dealloc if
your object retains other objects, but never call it. As Nathan
pointed out, it will be called implicitly when -release reduces the
retain count to zero.
--Andy
_______________________________________________
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.