• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Variable scope/lifetime of class methods (concerns Threads)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Variable scope/lifetime of class methods (concerns Threads)
      • From: Ole Voß <email@hidden>
References: 
 >Re: How to get buttonType from NSButton (From: RameshPVK <email@hidden>)
 >Re: How to get buttonType from NSButton (From: mmalcolm crawford <email@hidden>)
 >Variable scope/lifetime of class methods (concerns Threads) (From: Ole Voß <email@hidden>)

  • Prev by Date: Re: How can I create a PDF document from a string in a non-GUI application?
  • Next by Date: Request for mindburning beta testers
  • Previous by thread: Variable scope/lifetime of class methods (concerns Threads)
  • Next by thread: Re: Variable scope/lifetime of class methods (concerns Threads)
  • Index(es):
    • Date
    • Thread