Introduction to C++
Overloaded Function (Bonus)
The C++ language allows you to create functions with the same name, but the arguments of such functions must be different. Such functions are called overloaded.
The functions have the same "
func" name but different arguments.
In our case:
- When passing two arguments to a function, the function with two arguments will be called.
- When passing one argument to a function, the function with one argument will be called.