Imagine you have a function X() all over your codebase. It takes three arguments. The prototype looks something like this:
In header file:
void X(string a, int b, string c);
In .cpp file:
void myclass::X(string a, int b, string c) {
...
}
Suppose you are adding to the codebase, and have a particular need to pass a 4th argument to X in only one spot. The 3-argument calls all need to remain in place. You would like to avoid breaking all of the 3-argument versions of the calls to X.
I have tried using the advice here but this doesn't work. Answer one still produces errors of no matching function found. Trying to do what answer 2 suggestions yields errors that I can't overload the function. Specifically, I try this, based on answer 2 in that link:
In header file:
void X(string a, int b, string c, string d);
void X(string a, int b, string c, string d="default_value");
Any suggestions on how to correctly add a single 4-argument call without breaking all the 3-argument calls is much appreciated - thanks!