Re: Defining a constant as private
Re: Defining a constant as private
- Subject: Re: Defining a constant as private
- From: Joakim Danielson <email@hidden>
- Date: Wed, 16 Jun 2004 15:36:51 +0200
On 2004-06-16, at 13.44, Wade Tregaskis wrote:
How do I define a constant to be private to a class, and specially a
string constant?
ObjC isn't big on things being private... the only reliable way to do
this is to #define your value, but that's not a good idea for
non-immediate (i.e. non-integer, basically) values.
The best way, I guess, is to just define the constant in your
implementation file, so it's not visible to the outside world. Leave
it undocumented, or if you must document it make it quite explicit
that it shouldn't be used (provide a good reason, too). 3rd party
developers could always declare it as extern manually, but that's
probably a danger you'll have to accept... they could always modify
your source to expose it anyway, if all else fails. :)
Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
If I understand you correctly I can't make the constant truly private
and therefore I will have to make sure that the name of the constant is
unique even if I just declare it in my implementation file. Is this
correct?
Joakim
_______________________________________________
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.