Possible Duplicate:
Default value to a parameter while passing by reference in C++
Is it possible to do something like this:
// definition
bool MyFun(int nMyInt, char* szMyChar, double& nMyReferencedDouble = 0.0);
Then the function can be called either like this:
MyFun(nMyInt, szMyChar, nMyReferencedDouble);
or like this:
MyFun(nMyInt, szMyChar);
My compiler (VS 98) complains. Is there a way to do this?
You could overload the function instead.
This is how you get around the current limitations of no default values in C# and works equally well for semantic limitations in C++.