Jump to content

C++ Language/ProgramFlow/Parameters/DefaultParameter

From Wikibooks, open books for an open world

This is the current revision of this page, as edited by SoftwareEngineerMoose (discuss | contribs) at 07:02, 21 February 2022 (Created page with "{{C++ Language}} 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 <code>void DoMember(int aiParam = 123);</code> (use ordinary syntax when implementing this function). [https://www.youtube.com/watch?v=4QUmL-fVAMU Additional information about default parameters (includes interacti..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)