The book I'm using to learn C++ is talking about function overloading.
It states that 2 functions with the same name must have either a different amount of parameters, or some parameters of differing types.
So, for example, the following is legal, as both prototypes have different numbers of parameters:
1 2
|
void myFunc(int myVar, double myVar2);
void myFunc(int myVar, double myVar2, double myVar3);
|
as is (because there is at least 1 parameter of a different type):
1 2
|
void myFunc(int myVar, double myVar2);
void myFunc(double myVar, double myVar2);
|
What the book doesn't say, and I wondered, just for curiousity, is can you overload with the same number of parameters, of the same types, but in a different order. For example is the following legal:
1 2
|
void myFunc(int myVar, double myVar2);
void myFunc(double myVar2, int myVar);
|
Thanks. Note that in no way am I suggesting any of the above is a good idea/good practice, I just wondered, to satisfy my desire to learn as much as possible.