Re: about dealloc
Re: about dealloc
- Subject: Re: about dealloc
- From: Nathan Zamecnik <email@hidden>
- Date: Mon, 13 May 2002 00:16:47 -0500
I think that you mean "other" and "myText" are instance variables of your
class Foo. They are then not globel object but they are accessiable withen
your class....meaning your classes methods can access and change the value
for those objects. When the class is -init that is when you initilize those
objects then. The -dealloc method is where those objects (and any other
class instance variables) are released by ;other release]; and
[myText release];
The reason for this is because your class created instances of those objects
thereofer it is your classes job to release those objects.
BTW, you should never make instance variables public. They should always be
private or in some cases protected. If something wants to change one of
their values make whats called a mutator (a set function) function within
your class that changes it.
Hope this helps.
On 5/12/02 9:24 PM, "Antonio Inojal" <email@hidden> wrote:
>
Hi, say that I create two private objects in the .h file, meaning, they
>
are global. Now, changing the dealloc method and releasing the objects
>
there, will that release the objects? Let me illustrate my example.
>
>
Foo.h
>
There are, say, two private (non-IB) objects.
>
>
can I release those objects from the dealloc method such as:
>
in Foo.m:
>
>
- (void)dealloc
>
{
>
[other release];
>
[myText release];
>
[super dealloc];
>
}
>
where other and myText are two objects. Will this happen? Also, when
>
will the dealloc method get called, at the end of the program?? I
>
appreaciate your time very much. Thank You.
>
Tony
>
_______________________________________________
>
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.