• 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: class variables and class methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: class variables and class methods


  • Subject: Re: class variables and class methods
  • From: Robert Goldsmith <email@hidden>
  • Date: Thu, 8 Jan 2004 00:04:33 +0000

> That is just a static variable, and not a class variable (since there
> currently aren't such things).

So is it possible to precisely define the scope of the variable?

I assume that, if it is in the .m file, a static variable has the scope
of that file. If it is not static, it's scope is what? Global? If it is
in the .h file and static, what would it's scope be?

> No, not "easy", other than the way you just did it.

Ok, so at compile time, if there is a method that uses a static
variable, it is compiled down to use that variable even though a
subclass inherits the method and has it's own static variable :( In
other words, file scope static beats class scope static :(

> OTOH, even if Objective-C did have class variables, those class
> variables would be inherited by all subclasses, just like class
> methods are inherited by all subclasses.

Well, if they were proper class variables, it would only be sensible to
allow the @public, @protected and @private modifiers to work with them
- then you could choose how the variable behaved in inheritance.

It's a shame file static scope beats class static scope or the way I
coded my project would have been very neat :( I'll have to go and have
another look at this. Thanks :)

Robert
---
GnuPG public key:
http://www.Far-Blue.co.uk

[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
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.

  • Follow-Ups:
    • Re: class variables and class methods
      • From: lbland <email@hidden>
References: 
 >class variables and class methods (From: Robert Goldsmith <email@hidden>)
 >Re: class variables and class methods (From: Glenn Andreas <email@hidden>)

  • Prev by Date: [SOLVED] Re: NSOpenPanel weirdness
  • Next by Date: Re: XML and XSLT
  • Previous by thread: Re: class variables and class methods
  • Next by thread: Re: class variables and class methods
  • Index(es):
    • Date
    • Thread