Jump to content

C++ Language/ProgramFlow/Parameters/DefaultParameter

From Wikibooks, open books for an open world

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)