Re: Variable scope/lifetime of class methods (concerns Threads)
Re: Variable scope/lifetime of class methods (concerns Threads)
- Subject: Re: Variable scope/lifetime of class methods (concerns Threads)
- From: Ole Voß <email@hidden>
- Date: Thu, 18 May 2006 16:01:42 +0200
Hi Ondra,
I think I made myself misunderstood ;-)
Basically I understand that a class method is only 'instantiated'
(so-to-say) once for all objects that are created using this class.
All methods (class or instance ones) are implemented the same way:
they are very plain old functions, loaded along with the executable
(unless you use loadable bundles that means they are available for the
whole process lifetime). There is exactly one instance of each method,
be it a class or instance one.
Yes, I do understand that - I wasn't expressing myself clearly; sorry.
What I meant is that the variables used within a method are unique to
the object it is used within.
What I'm unsure about is what happens to the variables that are used
within a class method? It appears that these are also created only
once...
There are no class variables in ObjC. You can use plain C global
variables from class methods, which is what you normally want anyway.
Likewise I expressed myself badly here too :-(
What I meant here are the variables used within the class method. These
are unique as opposed to the variables of a method of an object that is
instantiated?
I've probably answered the question myself, but maybe somebody could
give me a hint as to where I can read more about this topic
IIRC, this all is described pretty well in the standard Apple ObjC
documentation.
Well, yes, probably, but although I've read so much of it already there
are sometimes things that you just overlook or can't recall.
Thanks for your time!
Regards,
Ole.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden