Newbie question - is where Obj-C analog for a C++ static data members?
Newbie question - is where Obj-C analog for a C++ static data members?
- Subject: Newbie question - is where Obj-C analog for a C++ static data members?
- From: Rustam Muginov <email@hidden>
- Date: Wed, 10 Sep 2003 11:23:17 +0400
Hello all.
I have a document-based applications, with several windows where different
objects are drawn.
I need to draw them with the different colors, depending on the object
"type" or "kind".
So I created the NSDictionary, with the colors as objects and object types
as the keys.
The questions is - how could I optimize my code and not the build such
colors dictionary for every WindowController (or for every document)?
In C++, I could declare the static data member for the class, init it with
NULL value, and then check it from the instance method, building the color
list if its not already build.
In Cocoa, I could probably define the "standalone" global variable and use
it for the same purposes, but I feel this is not very "cocoa-ish"
How should I implement "shared" object, which will be inited once and then
used by many instances?
_______________________________________________
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.