There can only be one function with the same signature. Altering the cv qualification of parameters does not change the function signature. Therefore the two foo functions have the same signature and the program is ill-formed.
int foo(int x, int y)
int foo(constint x, constint y)
int main(int argc, char** argv)
constint x = 3;
constint y = 2;
std::cout << foo(x,y) << std::endl;
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.