On Wed, 03 May 2006 12:32:45 +0300, Maksim Kasimov
<ma************@gmail.com> wrote:
i have two functions and both of them are to make changes into object field or get some results into caller function:
void FooFunc1(FooClass& a)
{ ...
void FooFunc2(FooClass* a)
{ ...
or
void FooFunc3(int& a)
{ ...
void FooFunc4(int* a)
{ ...
in what cases it is prefereble to use reference or pointer in parameter list?
Use references when you can pointers when you must (IIRC, this is a
FAQ). Pointers are only necessary when you also need to pass 0 (NULL)
to the function. The latter probably indicates a design problem
anyway.
Best wishes,
Roland Pibinger