• 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: Scoping of functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scoping of functions


  • Subject: Re: Scoping of functions
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 30 May 2002 00:54:26 +0200

On Thursday, May 30, 2002, at 12:00 , Bill Bumgarner wrote:

As long as you stick to a general rule of 'one class per .h or .m', then static variables as shown above are, effectively, class variables

Not really. Statics are still globals; class variables would belong to a particular class. Just make a subclass of your Thingamahover -- it would share the values contents with its superclass.

I haste to add that quite often it is exactly what you *wanted*, whilst true class variables -- one specific for each class, non-shared with any other regardless inheritance -- would not do what you need.

In those rare cases when you *need* class variables, the common approach is to define a global NSDictionary, use class ids (as NSValues) for keys, and store real values this way.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: Scoping of functions
      • From: Bill Bumgarner <email@hidden>
References: 
 >Scoping of functions (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Objective C <--> COM comparison
  • Next by Date: Re: NSURL question (easy (i think))
  • Previous by thread: Scoping of functions
  • Next by thread: Re: Scoping of functions
  • Index(es):
    • Date
    • Thread