C++ Language/ProgramFlow/Parameters/DefaultParameter

From Wikibooks, open books for an open world
Jump to navigation Jump to search

When defining a function having a parameter, you can specify a default value that will be used if the caller doesn't provide a value for that parameter. For a member function, this should appear in the class definition as void DoMember(int aiParam = 123); (use ordinary syntax when implementing this function).

Additional information about default parameters (includes interactive examples)