home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mole-end!mat
- From: mat@mole-end.matawan.nj.us
- Subject: Re: Make a deep copy!
- Message-ID: <1992Dec27.024000.26981@mole-end.matawan.nj.us>
- Summary: Deep .vs. Shallow: the Shallow and the Deep of it ...
- Organization: :
- References: <kwong.724744711@morgan> <1992Dec23.210224.566@microsoft.com>
- Distribution: usa
- Date: Sun, 27 Dec 1992 02:40:00 GMT
- Lines: 32
-
- In article <1992Dec23.210224.566@microsoft.com>, pauljo@microsoft.com (Paul Johns) writes:
-
- > Specifically, you need a copy constructor which
- > copies the data pointed to by the pointer in the
- > object. (You should copy both the actual data
- > and the array of pointers--I think you missed
- > copying the array of pointers in your assignment
- > operator.)
-
- > Also, read a good C++ text for other pointers.
-
- It seems to me that the whole question of Deep .vs. Shallow copy is
- misdirected. A program is--or should be--a model of something. A
- model is an abstraction expressed in a representation. That a copy
- is deep or shallow describes a technique of representation. It is
- pointless to discuss it without reference to the thing represented.
-
- Deep copy is necessary when you must copy not only one object (small `o'
- object) but also objects related to it. It may be that you must copy
- all objects related to it; it may be that you must copy only some objects
- related to it. To know what must be copied, you must understand the
- existential relationships in which the object participates, both their
- meaning and their requisite cardinality.
-
- And when you understand the issue on that level, Deep and Shallow become
- just two possibilities of many--but the correct possibility reveals itself
- so that you don't have to go asking the question.
- --
- (This man's opinions are his own.)
- From mole-end Mark Terribile
-
- mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
-