• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Defining a constant as private
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Defining a constant as private


  • Subject: Re: Defining a constant as private
  • From: Wade Tregaskis <email@hidden>
  • Date: Wed, 16 Jun 2004 21:44:58 +1000

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?
_______________________________________________
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.


References: 
 >Defining a constant as private (From: Joakim Danielson <email@hidden>)

  • Prev by Date: Re: Panther's NSScreen vs. screen resolution changes
  • Next by Date: Re: Defining a constant as private
  • Previous by thread: Defining a constant as private
  • Next by thread: Re: Defining a constant as private
  • Index(es):
    • Date
    • Thread