Function Overloading
Function overloading in the traditional sense refers to a feature allowing multiple functions to have the same name, but with different parameter lists (more or fewer arguments, different types...).
- β οΈ The name of the arguments is ignored
- β οΈ The return type is ignored
- Some languages may have different constraints
Some languages allow a non-traditional overload, where the last declared function with the same name overrides all previous ones.
int xxx(); // β
int xxx(String xxx); // β
int xxx(String yyy); // β conflict with 2
int xxx(String xxx, int yyy); // β
int xxx(int xxx, String xxx); // β
float xxx(String xxx); // β conflict with 2
float xxx(int xxx); // β οΈ may not be accepted