On Tue, Aug 03, 2004 at 11:11:40PM -0400, MenTaLguY wrote:
Yes, I would prefer that any new "methods" be added as real C++ methods.
I'm not sure what is meant by `"methods"' above, but these days I tend to prefer non-member functions over member functions:
- Information-hiding principle suggests that if a function doesn't need access to private variables then it's better not to make it a member function.
- Member functions must be declared in the class definition, which tends to require more recompilation because one can't use a separate header file.
A related issue is that it's harder (impossible) to write private specializations: any specialization must be declared in the class definition too, so it isn't private other than through comments.
- The shorter names typical of member functions are harder to search for.
(Counter-argument: this is a matter of custom, there's no technical reason why one can't use long names for member functions, or even short names for non-member functions.)
pjrm.