home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pageworks.com!world!eff!ssd.intel.com!ogicse!uwm.edu!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!umn.edu!csus.edu!netcom.com!mspace
- From: mspace@netcom.com (Brian Hall)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Duplicate Object in Think C?
- Message-ID: <1992Dec20.203018.6764@netcom.com>
- Date: 20 Dec 92 20:30:18 GMT
- Article-I.D.: netcom.1992Dec20.203018.6764
- References: <white.724729120@sfu.ca> <1992Dec20.160310.28061@eng.umd.edu>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Lines: 25
-
- russotto@eng.umd.edu (Matthew T. Russotto) writes:
- >In article <white.724729120@sfu.ca> white@fraser.sfu.ca (Steve White) writes:
- >>How do you duplicate an object without knowing its class? We would like
- >>to write something like
- >[...]
- >>sizeof( class_name )
- >>
- >>will return the size of an object in a class. We get "illegal use of
- >>class type" when we try to compile, e.g.,
- >>
- >>sizeof( Window )
-
- Have you tried newObj = oldObj->Copy(); Copy is a method of the CObject
- class. It will make a copy of the object, but you may want to override
- it in subclasses to make sure it makes a copy of the data, and not a copy
- of the references to data, if that is what you want.
-
-
- --
-
- \ | / | Brian Hall mspace@netcom.com
- - : - | Mark/Space Softworks Applelink: markspace
- /|\ | America Online: MarkSpace
- |-+-| |
- /-\|/-\ | PUI: Programming Under the Influence.
-