stri(){}
stri(char *s);//constructor used to initilize object with constant string
stri(stri &s1);//copy constructor performs memberwise copy
friend stri oper
Let me dust off my crystal ball and guess that the error you're getting is somewhere along the lines of "temporary cannot bind to reference." That's because your copy constructor takes its parameter as stri &
instead of const stri &
; in other words, a reference to non-const. Such references cannot bind to temporaries. s1 + s2
returns a temporary, so the copy ctor invocation fails.
Unless you're doing really whacky stuff in your copy ctor (modifying the object copied from), change it to take its parameter as const stri &
.