If a function parameter has a default argument, must all subsequent parameters also have default arguments?
- It depends
- No, never
- Yes, always
- Yes, in some cases
No, never. In C++, if a function parameter has a default argument, subsequent parameters are not required to have default arguments. Default arguments allow calling a function with fewer arguments, and the missing arguments will take on their default values.
Loading...
Related Quiz
- A function that does not return a value has a return type of _______.
- If the function is a member of a class, and default values are provided at function _______, then these default values become part of the class.
- The ______ operator is used to check if two operands are equal.
- Daniel came across a codebase where functions are mentioned at the beginning but their actual workings are given at the end. What approach is this codebase following?
- The keyword _______ is used to access the base class’s members in the derived class.