Understanding function overloading
C++ allows for two or more functions that share a similar purpose, yet differ in the types or number of arguments they take, to co-exist with the same function name. This is known as function overloading. This allows more generic function calls to be made, leaving the compiler to choose the correct version of the function based on the type of the variable (object) using the function. In this section, we will add default values to the basics of function overloading to provide flexibility and customization. We will also learn how standard type conversions may impact function overloading, and potential ambiguities that may arise (as well as how to resolve those types of uncertainties).
Learning the basics of function overloading
When two or more functions with the same name exist, the differentiating factor between these similar functions will be their signature. By varying a function’s signature, two or more functions with otherwise identical...