Re: Good Habits (was: Re: C question for you old guys ;-))
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.