• 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: 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


  • Follow-Ups:
    • Re: Variable scope/lifetime of class methods (concerns Threads)
      • From: j o a r <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>)
 >Re: Variable scope/lifetime of class methods (concerns Threads) (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: awakeFromNib not called immediatly after initWithWindowNibName
  • Next by Date: URI de/encoding
  • Previous by thread: Re: Variable scope/lifetime of class methods (concerns Threads)
  • Next by thread: Re: Variable scope/lifetime of class methods (concerns Threads)
  • Index(es):
    • Date
    • Thread