how to merge two string with operator overloading? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to merge two string with operator overloading?

operator overloading

16th Aug 2017, 4:39 AM
Harsh Arya
Harsh Arya - avatar
5 Answers
+ 2
+ operator already exist for that ! But if you want to create your own, can you be more specific please ? which operator do you want to overload and with "std::string" or "char*" ?
16th Aug 2017, 5:16 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
+ operator is already overloaded for strings concatenation, but here are some examples of operator overloading https://code.sololearn.com/cY3F5nSBpmNC/?ref=app https://code.sololearn.com/cuupdNnR9agh/?ref=app https://code.sololearn.com/cp3M2lJpklrH/?ref=app
16th Aug 2017, 3:26 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
In fact, doing for string also do it for char* so just string is enough. Moreover, you did not answer the first part of what I said, can you be more specific please ? :/ Which operator you want to overload ?
16th Aug 2017, 1:37 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
tell me from both... if you can send me the source code for that program that will be good
16th Aug 2017, 7:04 AM
Harsh Arya
Harsh Arya - avatar
0
any operator like +
16th Aug 2017, 3:22 PM
Harsh Arya
Harsh Arya - avatar