• 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: Good Habits (was: Re: C question for you old guys ;-))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Good Habits (was: Re: C question for you old guys ;-))


  • Subject: Re: Good Habits (was: Re: C question for you old guys ;-))
  • From: Shimaron Greywolf <email@hidden>
  • Date: Mon, 9 Jun 2003 20:58:35 +0200

One more from me: In C++ classes, I hide all attributes from the outside
(making them private or protected), but offer access functions. The
"Set" (writing) access function then usually include some kind of
consistency check of the new value, the "Get" (reading) access method
always returns a const copy of the value. THis of course is a little bit
different if I associate some objects whose pointers I pass to the outside.
Here I offer a const version that is preferably used and a non-const
version that I only use if I need to.

Oh, that brings me to another thing: I make variables const all of the
time if they are. That makes it a lot easier to spot assignment errors
because you can see them at compile time.

BTW, Meyer I & II are a very good read on reliable C++. I only do objective C
as a hobby.

Chris
_______________________________________________
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: 
 >Re: Good Habits (was: Re: C question for you old guys ;-)) (From: Joe Osborn <email@hidden>)
 >Re: Good Habits (was: Re: C question for you old guys ;-)) (From: Oscar Morales Vivó <email@hidden>)

  • Prev by Date: Re: C question for you old guys ;-)
  • Next by Date: Re: C question for you old guys ;-)
  • Previous by thread: Re: Good Habits (was: Re: C question for you old guys ;-))
  • Next by thread: Re: Good Habits (was: Re: C question for you old guys ;-))
  • Index(es):
    • Date
    • Thread