Function Overloading in C++

Watch out! This tutorial is over 7 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
Tutorial Difficulty Level    

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");
}