• 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: NSArray as a class variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray as a class variable


  • Subject: Re: NSArray as a class variable
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Sat, 26 Dec 2009 01:15:55 -0600

On Fri, Dec 25, 2009 at 10:52 PM, Michael Craig <email@hidden> wrote:
> #import <Cocoa/Cocoa.h>
>
> static NSArray *suitArray;

I doubt you really mean this. When you put this in your header file,
every file that includes "Card.h" has its own, separate copy of
suitArray. If you want to export a shared global into every file, then
Card.h should have:

extern NSArray *suitArray;

and Card.m:

NSArray *suitArray;

If you only want one copy, only visible from your implementation file,
then put this in Card.m:

static NSArray *suitArray;
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSArray as a class variable (From: Michael Craig <email@hidden>)

  • Prev by Date: Re: NSArray as a class variable
  • Next by Date: Re: Detect dim/brightness keys on laptop
  • Previous by thread: Re: NSArray as a class variable
  • Next by thread: Detect dim/brightness keys on laptop
  • Index(es):
    • Date
    • Thread