On Mon, Jul 21, 2008 at 10:57 PM, Ákos Maróy
- how do I create an instance of the same name as its type?
I would either A) try and find a better name for the type, or B) find a better name for the instance. If the instance has a very brief lifetime, limited scope, or is otherwise obvious to a developer (e.g. the single parameter to a string utility function), I might abbreviate it's name, usually right down to a single character. string s = "Richard";
- how do I declare accessor functions to private members? ... should I put some prefix to the private member's name?
Not a prefix, but a a trailing underscore suffix is generally used (identifiers starting with an underscore are reserved for the compiler). class foo { public: int bar() const { return bar_; } private: int bar_; }; Cheers, Rich