• 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: Global Variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global Variables


  • Subject: Re: Global Variables
  • From: BlueHorseshoe <email@hidden>
  • Date: Tue, 22 Mar 2005 00:31:31 -0500


On Mar 22, 2005, at 12:19 AM, Adam wrote:

I know including it in every class is overkill, but I have variables that 3 or 4 classes share and I am constantly changing them in multiple places. Will an extern work with cocoa code like NSString?

Yes, NSString's or any other C struct can be declared "extern," but as Mr. Deadman suggests you are embarking on a bad design.


I would suggest that you assign one class some kind of ownership role for these shared variables and then use normal methods for the other classes to access it.

_______________________________________________
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: Global Variables
      • From: Michael Crawford <email@hidden>
References: 
 >Global Variables (From: Adam <email@hidden>)
 >Re: Global Variables (From: Johnny Deadman <email@hidden>)
 >Re: Global Variables (From: Adam <email@hidden>)

  • Prev by Date: Re: newbie EXC_BAD_ACCESS
  • Next by Date: Inspector window
  • Previous by thread: Re: Global Variables
  • Next by thread: Re: Global Variables
  • Index(es):
    • Date
    • Thread