Ok, but how does the program understand/work when you pass a value to the function or call a function in the public section of class. Does it work depending on the order of methods in the class ?
Ok, I read the information in the link you provided, so briefly the signature is
a) The number of parameters
b) The data type of parameters
c) The order of appearance
My final question is:
Given the first sample code I provided above, does the program understand to send 5 to the method in the class which has the data type of int in its parameter just because 5 is an int ? so in another words, the idea of calling and passing by value depends on what data type you are trying to pass to the function and what data type the function/method has in its parameter to receive the right number ?
1 2 3 4 5 6 7 8 9 10 11
printData pd;
// Call print to print integer
pd.print(5);
// Call print to print float
pd.print(500.263);
// Call print to print character
pd.print("Hello C++");
does the program understand to send 5 to the method in the class which has the data type of int in its parameter just because 5 is an int
Indeed it does, try 5.0 instead of 5 and you'll find that the float overload is being called. If you are interested, the way the compiler achieves this is through name decoration or name mangling: https://msdn.microsoft.com/en-in/library/56h2zst2.aspx