+ 2
In C++, how will the compiler distinguish between overloaded functions and functions with default values for the arguments
for example if I have two overloaded methods, one takes only one integer (e.g: myfunc(int var) ), and the other one takes two integers with default values (e.g: myfunc(int var, int varr = 3) ). and when I call them in the main() I pass only one parameter! (e.g: myfunc(5); )...which one will be called? the one with one argument or the other one and it will consider the other integer with its default value?! and why?
4 Answers
+ 1
sorry, I didn't understand đ
+ 1
I've just edited the description of the question to make it clear if it was'nt :)
0
iirc you would have to do function(varName, int) for the default value to come out.
0
if you pass it a blank value it should access the default