C++
Function Overloading in C++ with example code
seoca
2018. 11. 3. 06:37
Function Overloading
Function overloading allows you to use the same function name for more than one definition in the same scope.
Function overloading has rules
first, it should have the same function name.
second, the number of arguments or the types should be different.
Example code
Result
When function 'func(4)' is called in main, function 'func(int a)' executed because it coincides with the type and the number of argument. And the same goes for func(int a, int b).