CS202 6- ‹#›
Efficiency Considerations
nWhile the code on the previous slide looks clean and simple, it has serious performance drawbacks.
nThis is because it creates a temporary string object from the argument, creates a second temporary object as a result of the concatenation, and then uses the copy constructor to copy that temporary back into the original object (*this).
nIf the object was a large object, this simple operation could end up being very expensive!