Re: Retain, then autorelease and then release does what?
Re: Retain, then autorelease and then release does what?
- Subject: Re: Retain, then autorelease and then release does what?
- From: "Erik M. Buck" <email@hidden>
- Date: Mon, 6 May 2002 00:13:16 -0500
- Organization: EMB & Assocites Inc.
----- Original Message -----
From: "Nathan Zamecnik" <email@hidden>
To: "Joel Rosenblum" <email@hidden>; <email@hidden>
Sent: Sunday, May 05, 2002 10:02 PM
Subject: Re: Retain, then autorelease and then release does what?
>
> Also, I'd like a bit of clarification on one point: if I have a property
>
> of a class which the class retains, when the class is released, will all
>
> of its objects automatically be released as well, or must I explicitly
>
> release each of them at that time?
>
I think you get this terminology (property) from REALbasic. In Cocoa you
>
would call it data member, member , member object or something similar.
It is an instance variable. Member is C++.
>
Anyways, to answer your question anytime you create an object like :
>
MyObjectInstance = [[myObject alloc]init];
>
>
It is your job to at some time make sure that object is sent:
>
[myObjectInstance release];
Or [myObjectInstance autorelease]; BUT NOT BOTH
>
>
That is why in any class you make you write a method called a destructor.
destructors are C++.. Objective-C has no such thing.
>
You do this simply by make an class method called -(void)release;
NO NO NO! You write a -(void)dealloc method. It is NOT normal to
override -release!
>
Inside that method just simply give the release call to any object you
>
allocated memory to.
>
-- NAteZ
>
_______________________________________________
>
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.