1. Is there any good reason why C++ does not support more flexible default values such as
1 |
printValues(,,3) |
and
1 |
void printValue(int x=10, int y); |
?
2. It seems strange that “Once declared, a default parameter can not be redeclared.” even when the declarations are exactly the same. Is there any good reason why this is not allowed?
3. In the function overload example:
1 2 |
void printValues(int x); void printValues(int x, int y=20); |
the statement is made that “… the compiler would not be able to disambiguate…” such a situation. Note that it could easily do this if the requirement is to write
1 |
printValues(10,) |
if the second function were desired.