 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
While
the code on the previous slide looks clean
|
|
|
and
simple, it has serious performance drawbacks.
|
|
| • |
This
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).
|
|
|
| • |
If
the object was a large object, this simple
|
|
|
operation
could end up being very expensive!
|
|