Overloading + to add two pointers
- by iAdam
I have a String class and I want to overload + to add two String* pointers.
something like this doesn't work:
String* operator+(String* s1, String* s2);
Is there any way to avoid passing by reference.
Consider this example:
String* s1 = new String("Hello");
String* s2 = new String("World");
String* s3 = s1 + s2;
I need this kind of addition to work. Please suggest.