Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!luth!sunic!kth.se!news From: d88-eli@draken.nada.kth.se (Erik Liljencrantz) Newsgroups: comp.lang.pascal Subject: Re: (one way to) Copying objects in Turbo Pascal 5.5 Message-ID: <1990May28.150855.6710@kth.se> Date: 28 May 90 15:08:55 GMT References: <4878@plains.UUCP> <1990May25.132722.29073@maytag.waterloo.edu> Reply-To: d88-eli@nada.kth.se (Erik Liljencrantz) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 18 In article <1990May25.132722.29073@maytag.waterloo.edu> dmurdoch@watstat.uwaterloo.ca (Duncan Murdoch) writes: >In article <4878@plains.UUCP> gus@plains.UUCP (jim gustafson) writes: >>>I'd like to have a constructor for an object that just copies another instance >>>of it or one of its descendants, and (the hard part) also copies the type >>>information. ... >(Since they're descendants, they may contain lots of other stuff too.) ... >Duncan Murdoch I believe the SizeOf operator knows how to compute the size of a descendant (the VMT described in the OOPS-manual contains a special size-field for this purpose). If "the lot's of other stuff" in the descendant doesn't contain any pointers which contents also should be duplicated SizeOf should be sufficient to copy the contents (my favorite: Move, fast but dangerous!). --- Erik Liljencrantz | "No silly quotes!!" d88-eli@nada.kth.se | Embraquel D. Tuta