Overload resolution and overload sets
This section will test your knowledge of the latest and most advanced additions to the C++ standard. We will start with one of the most basic features of C++, functions, and their overloads.
C++ function overloading
Function overloading is a very straightforward concept in C++; multiple different functions can have the same name. That’s it, that is all there is to overloading - when the compiler sees syntax that indicates a function call, formatted as f(x)
, then there must be more than one function named f
. If this happens, we are in an overload situation, and overload resolution must take place to find out which of these functions should be called.
Let’s start with a simple example:
// Example 01 void f(int i) { cout << “f(int)” << endl; } // 1 void f(long i) { cout << “f(long)” << endl; } // 2 void...