Skip to content

Commit

Permalink
Refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Douglas committed May 20, 2020
1 parent 61dd799 commit c00930d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions functions/defaulted_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Functions in C++ may be overloaded with different numbers and types of parameter
</thead>
<tr>
<td>Foundational knowledge</td>
<td>can make calls to functions with defaulted parameters, with or without defaulted parameters</td>
<td>can make calls to functions with or without defaulted parameters</td>
</tr>
<tr>
<td>Advanced</td>
Expand All @@ -26,19 +26,19 @@ Functions in C++ may be overloaded with different numbers and types of parameter

## Motivation

Default parameters allow the omission of explicitly stating commonly defined parameters, using sensible defaults. Also allows expansion of function signature without forcing existing consumers to modify their calls.
Default parameters allow the omission of parameters with obvious or common values. Also may be utilized to extend an existing function signature without forcing changes to existing calling code.

## Topic introduction

Explains how default parameters work and how to define them.
Explain how default parameters work and how to define them.

## Foundational knowledge: Using *

### Background/Required Knowledge

A student is able to:

* Make calls existing functions using parameters
* Make calls to existing functions, passing parameters
* Declare member and non-member functions, separate from definitions
* Define member and non-member functions
* Explain what a default constructor is and does
Expand All @@ -49,23 +49,19 @@ A student should be able to:

1. Call to a function with a default parameter with or without that parameter specified
2. Explain what the requirements are for a type to be usable with a default parameter
3. Explain when the lifetime of a defaulted parameter begins and ends

### Caveats

_This section mentions subtle points to understand, like anything resulting in
implementation-defined, unspecified, or undefined behavior._
### Caveats

* When no forward-declaration exists, the definition serves as the declaration
* When multiple declarations exist, only one may specify the default for any particular parameter, but multiple declarations may specify the defaults for different parameters.
* Default values may be specified for new parameters in new declarations
* Additional default values may be specified for other parameters in repeat declarations
* Calling an overloaded function with fewer parameters may be ambiguous with regard to an overload with defaulted parameters

### Points to cover

_This section lists important details for each point._

* Default value may only be specified once for each parameter
* Default values must start from the right
* Default value may only be specified once for each parameter among all declarations

## Advanced: implementing *

Expand All @@ -81,9 +77,11 @@ A student should be able to:

### Caveats

* Default values must start from the right-most parameter and continue left-ward without gaps

### Points to cover

## Further studies

_These are important topics that are not expected to be covered but provide
guidance where one can continue to investigate this topic in more depth._
Learning the extent to which you may further specify new default values and rules related to what is necessary for a consumer to take advantage of additionally defaulted values.

0 comments on commit c00930d

Please sign in to comment.