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: Ondra Cada <email@hidden>
- Date: Thu, 18 May 2006 14:03:59 +0200
Ole,
On 18.5.2006, at 9:45, Ole Voß wrote:
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.
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.
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.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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