As in Java, a function name may be reused with different parameter types.
#include <iostream> #include <string> using namespace std; void fred(int a) { cout << "fred the first, " << a << endl; } void fred(int a, string b) { cout << "I am the second fred: " << a << " " << b << endl; } void fred(string c, string d = "ding!") { cout << "Lo, I am fred tertiary. " << c << " " << d << endl; } int main() { fred(17); fred("this"); fred(24, "hours"); fred("some", "day"); }