Navigation



7.8 — Function Pointers

Function pointers are an advanced topic, and this section can be safely skipped or skimmed by those only looking for C++ basics.

In the lesson on pointers, you learned that a pointer is a variable that holds the address of another variable. Function pointers are similar, except that instead of pointing to variables, they . . . → Read More: 7.8 — Function Pointers

7.7 — Default parameters

A default parameter is a function parameter that has a default value provided to it. If the user does not supply a value for this parameter, the default value will be used. If the user does supply a value for the default parameter, the user-supplied value is used.

Consider the following program:

void PrintValues(int . . . → Read More: 7.7 — Default parameters

7.6 — Function overloading

Function overloading is a feature of C++ that allows us to create multiple functions with the same name, so long as they have different parameters. Consider the following function:

int Add(int nX, int nY) { return nX + nY; }

This trivial function adds two integers. However, what if we also need to add . . . → Read More: 7.6 — Function overloading