Thread
:
Stadard C i/o problems with C++ classes
View Single Post
Jul 14th, 2007, 12:11 PM
#
8
DaWei
Resident Grouch
Join Date: Jun 2005
Posts: 6,453
Rep Power:
10
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
View Public Profile
Visit DaWei's homepage!
Find More Posts by DaWei