John is writing a function to concatenate two strings. He wants the function to add a space between the strings by default but also wants to give the user the option to specify their own separator. Which feature of C++ can help him?

  • Default Arguments
  • Function Overloading
  • Function Templates
  • Operator Overloading
John can use Default Arguments in C++ for his string concatenation function. By providing a default value for the separator parameter, he ensures that if the user doesn't specify a separator, a space is added by default. However, users can still customize the separator if they want.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *