Hi, is here any other issues then readability between two functions below?

void getNames(int) {
....
}
void getnames(int meaningfullName) {
static_cast<void>(meaningfullName);
...
}

Yeah, in the first function how do you plan on using the value provided to the argument/parameter to the function without naming it within the function's scope?

Edited 5 Years Ago by Fbody: n/a

There is not sufficient difference between them to cause the overloading mechanism to work properly.

For overloading to work, a function's name must be identical with different type and/or number of arguments/parameters.
These are some valid overloads:

void sampleFunction();         //no arguments
void sampleFunction(int);      //one (1) int argument
void sampleFunction(int, int); //two (2) int arguments
void sampleFunction(double);   //one (1) double argument

See the differences in the argument types/counts? You could call any one of these depending on how you write the call. There is no way to differentiate between your functions when you call them because they both have one (1) int argument.

Edited 5 Years Ago by Fbody: n/a

yes, that's true,and I asume there an other issue if you work in team and if function is prety big and if your code is readed by someone else, the second version is more readable..

This question has already been answered. Start a new discussion instead.