362 ◾ Appendix B
used to avoid data redundancy or integrity problems. Aliases are problem-
atic when not tracked. If two dierent pointers (references) hold the same
address to a heap object and each pointer assumes that it owns this heap
data, then either pointer can manipulate this data, including deallocating
it, without regard to any other “owner.” In C++, with a properly dened
destructor, but without properly dened copying, if objB were to go out of
scope before objA, then objA would continue to point to memory that it
no longer owned. Premature deallocation, data corruption, and memory
leaks are all undesirable side-eects of unforeseen aliasing.
Figure B7 illustrates properly dened deep copying: the value of every
nonpointer e ...