View Single Post
Old Jul 14th, 2007, 12:11 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Yeah. It's a matter of shallow copy versus deep copy. You'd have the same problem if you instantiated lll and assigned kkk to it. When kkk went away, it'd be bogus. You'd need to write a copy constructor and make a deep copy.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote