proper syntax for static variables in a class
proper syntax for static variables in a class
- Subject: proper syntax for static variables in a class
- From: Donald Hall <email@hidden>
- Date: Sun, 9 Jun 2002 00:41:21 -0600
I have an object that I want to be shared by all instances of a class.
Currently I have the following structure, but I wonder if this is
correct. (It seems to compile and run okay, but I could find nothings in
the docs.)
In MyClass.m I have:
#import "MyClass.h"
@implementation MyClass
static NSArray *mySharedData;
+(void)initialize
{
// fill in mySharedData here
}
Declaring mySharedData above '@implementation MyClass' works equally
well.
Declaring mySharedData anywhere in the header file doesn't seem to work.
Is there a "correct" way to do this? A preferred style?
Thanks,
Don
----------------------------------------------
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
_______________________________________________
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.