Say I have a function like the following in c++,
int sum(int x = 0, int y = 0) {
return x + y;
}
I can use the default value of y by calling the function like sum(3)
which would then return 3. Is it possible to use the default value of x, and not y? I know I can call the function with the default value of x explicitly like sum(0,4)
, but is there a way to call the function like sum(y = 4)
which would then use the default value of x?