home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!mac4.jpl.nasa.gov!user
- From: sgrenander@NASAMAIL.JPL.NASA.GOV (Sven U. Grenander)
- Subject: Re: Duplicate Object in Think C?
- Message-ID: <sgrenander-050193152741@mac4.jpl.nasa.gov>
- Followup-To: comp.sys.mac.programmer
- Sender: news@elroy.jpl.nasa.gov (Usenet)
- Nntp-Posting-Host: mac4.jpl.nasa.gov
- Organization: Jet Propulsion Laboratory
- References: <white.724729120@sfu.ca> <1992Dec19.002858.299@physc1.byu.edu> <d!q2saf@rpi.edu> <1993Jan5.015329.15824@reed.edu> <noah-050193094549@noah.apple.com>
- Date: Tue, 5 Jan 1993 23:29:39 GMT
- Lines: 36
-
- In article <noah-050193094549@noah.apple.com>, noah@apple.com (Noah Price)
- wrote:
- >
- > In article <1993Jan5.015329.15824@reed.edu>, eric@reed.edu (eric) wrote:
- > >
- > > Don't thinkC objects know what class they are, and can't you get this
- > > using CObject::GetClassName? I don't think that you have to override
- > > this method, but then I can't recall ever having used it so . . .
- >
- > Are you talking about copying objects? I don't think you need to worry
- > about getting the class name.
- >
- > The object itself will be copied by
- >
- > newObject = anyObject->Copy();
- >
- > The reason that I (and Brian Hall, I think) was suggesting you might need a
- > subclass is only if your object contains a reference to data that also
- > wants to be duplicated.
- >
- > For example, if one of your instance variables is a handle, the Copy()
- > method will copy the handle (i.e., you'll have another pointer to the same
- > master pointer), but NOT the data the handle references. You have to
- > decide for the particular situation if you just want a second handle to the
- > same data, or if you want a new copy of the data.
- >
- > noah
- >
- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- > noah@apple.com Macintosh Hardware Design
- > ...!{sun,decwrl}!apple!noah (not the opinions of) Apple Computer, Inc.
-
- Not just handles. Poniters to dynamically allocated arrays would also cause
- problems.
-
- -Sven
-