Can we use default arguments for both member methods of a class and standalone functions?
- No, for neither
- Yes, for both
- Yes, for member methods only
- Yes, for standalone functions only
Yes, for both. In C++, you can use default arguments for both member methods of a class and standalone (non-member) functions. Default arguments provide flexibility when calling functions or methods by allowing you to omit some arguments if they have defaults defined.
Loading...
Related Quiz
- Samantha encounters a scenario where she needs to exit out of multiple nested loops upon a particular condition. What programming construct can she use to achieve this efficiently?
- In C++, which of the following groups of operators have the same level of precedence?
- What is the output of the logical NOT (!) operator when applied to a non-zero operand?
- Alex wants to create a menu-driven program that keeps displaying the menu until the user selects the 'Exit' option. Which loop is best suited for this task?
- Which function is used to open a file in C++?