home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 20119 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.4 KB

  1. 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
  2. From: mspace@netcom.com (Brian Hall)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Duplicate Object in Think C?
  5. Message-ID: <1992Dec20.203018.6764@netcom.com>
  6. Date: 20 Dec 92 20:30:18 GMT
  7. Article-I.D.: netcom.1992Dec20.203018.6764
  8. References: <white.724729120@sfu.ca> <1992Dec20.160310.28061@eng.umd.edu>
  9. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  10. Lines: 25
  11.  
  12. russotto@eng.umd.edu (Matthew T. Russotto) writes:
  13. >In article <white.724729120@sfu.ca> white@fraser.sfu.ca (Steve White) writes:
  14. >>How do you duplicate an object without knowing its class?  We would like
  15. >>to write something like
  16. >[...] 
  17. >>sizeof( class_name )
  18. >> 
  19. >>will return the size of an object in a class.  We get "illegal use of
  20. >>class type" when we try to compile, e.g., 
  21. >> 
  22. >>sizeof( Window )
  23.  
  24. Have you tried newObj = oldObj->Copy();  Copy is a method of the CObject
  25. class.  It will make a copy of the object, but you may want to override
  26. it in subclasses to make sure it makes a copy of the data, and not a copy
  27. of the references to data, if that is what you want.
  28.  
  29.  
  30. -- 
  31.  
  32.  \ | /   | Brian Hall                 mspace@netcom.com
  33.  - : -   | Mark/Space Softworks       Applelink: markspace
  34.   /|\    |                            America Online: MarkSpace
  35.  |-+-|   |
  36. /-\|/-\  | PUI: Programming Under the Influence.
  37.