Computer Science - Object Oriented Programming Using C++ - Discussion


When you omit parameters from a function call, values can be provided by

[A]. formal parameters
[B]. reference parameters
[C]. overloaded parameters
[D]. default parameters

Answer: Option D


No answer description available for this question.

Jjj said: (Feb 17, 2012)  
Default Function Arguments
A function can be called without specifying all its arguments. The function declaration must provide default values for those arguments that are not specified.

Ayesha... said: (Jun 17, 2020)  
Once we provide a default value for a parameter, all subsequent parameters must also have default values.

For example:

// Invalid
void add(int a, int b = 3, int c, int d);

// Invalid
void add(int a, int b = 3, int c, int d = 4);

// Valid
void add(int a, int c, int b = 3, int d = 4);

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.