can any one tell me .Is there any benefit of passing string as func(string& ) instead of func( string).
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Passing an object by reference means, well, that you’re passing the reference by value, instead of passing the object by value, which means that you have to made a copy at function invocation.
However, passing-by-reference introduces a new set of questions which you must be aware of:
constmodifierThe point is: just because passing-by-reference makes function invocation cheaper does not means that you must use it in any case.