On Mon, Sep 1, 2008 at 1:47 PM, Richard Good <[EMAIL PROTECTED]> wrote:

> I'm trying to create an array of string constants to be used inside the
> Person class.
> So let me rephrase the question How do I create an array of constant strings
> such that I have only one instance for the entire class,
> or is that just not possible.

@interface
+ (NSArray*) strings;
@end

@implementation
+ (NSArray*) strings {
    static NSArray* strings = nil;
    if (strings == nil) {
        strings = [[NSArray alloc] init...];
    }
    return strings;
}
@end

Doing the above hides the static var inside of the method so it
doesn't pollute the file scoped/global name space.

-Shawn
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to