C++ | Function Overloading

What is function overloading?

The concept of function overloading states that we can have two or more functions sharing the same name, but they have to be different in either of the two ways

(i). Different number of arguments

(ii). Different data types.

Advantages

  • Functions performing similar operations can share the same name.
  • Readability of the program increases.
  • Understanding the program becomes easier.
  • The programmer is not required to remember different function names performing similar operations.
  • The programmer can concentrate more on logic development than remembering different function names performing similar operations.

Note: The return type of overloaded functions may or may not be the same. It is of no concern.