Re: Class Constants
Re: Class Constants
- Subject: Re: Class Constants
- From: matt neuburg <email@hidden>
- Date: Sun, 30 May 2004 19:18:49 -0700
On Sun, 30 May 2004 17:57:53 -0600, James Stroud <email@hidden>
said:
>
I would like to make a NSDictionary filled with the same values
>
available to all instances of a class. (It would not change from
>
instance to instance, but all instances will need it. I want to read
>
this dictionary in from a plist, but I think it would be wasteful for
>
each instance to have its own copy of the dictionary. Its not obvious
>
to me how I would go about implementing this. Does anyone have any
>
advice.
Just declare the NSDictionary variable at the top of the class's
implementation. You can initialize it in the class's +initialize method or
you can implement a kind of singleton architecture where you
initialize-and-fetch it in a class method, in this example:
<
http://developer.apple.com/documentation/Cocoa/Conceptual/Foundation/
Concepts/ClassClusters.html#//apple_ref/doc/uid/20000262-589659>
m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide! NOW SHIPPING...! (Finally.)
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.