• 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: Daniel Jalkut <email@hidden>
  • Date: Tue, 27 Dec 2005 09:50:58 -0500

I noticed that the responses thus far have neglected to answer the "easy" part of your question.

If you want to take the "quick and dirty" route for this, it has nothing to do with Objective-C or OOP. Just use a global variable in your main controller's source file, as you would in any conventional C setting:

int myArray[10];

Then make an extern reference to it in the associated header file:

extern int myArray[10];

Now everybody who imports the header file has access to the array.

Daniel

On Dec 27, 2005, at 5:55 AM, Matt Reagan wrote:

int myIntArray[10];

But despite the public command, I can't seem to access it from another
class. I made sure to include the controller's header file where it's
needed.

What's the easiest way to make some integers available to the whole application?


_______________________________________________
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: Uli Kusterer <email@hidden>
    • Re: Global variables?
      • From: Matt Reagan <email@hidden>
References: 
 >Global variables? (From: Matt Reagan <email@hidden>)

  • Prev by Date: Re: Prevent running in Rosetta
  • Next by Date: Retrieving data returned by AppleScript
  • Previous by thread: Re: Global variables?
  • Next by thread: Re: Global variables?
  • Index(es):
    • Date
    • Thread