Passing optional parameter by reference in c++
- by Moomin
I'm having a problem with optional function parameter in C++
What I'm trying to do is to write function with optional parameter which is passed by reference, so that I can use it in two ways (1) and (2), but on (2) I don't really care what is the value of mFoobar.
I've tried such a code:
void foo(double &bar, double &foobar = NULL)
{
…