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

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!hamblin.math.byu.edu!yvax.byu.edu!physc1.byu.edu!seth
  2. Newsgroups: comp.sys.mac.programmer
  3. Subject: Re: Duplicate Object in Think C?
  4. Message-ID: <1992Dec19.002858.299@physc1.byu.edu>
  5. From: seth@physc1.byu.edu
  6. Date: 19 Dec 92 00:28:58 -0700
  7. References: <white.724729120@sfu.ca>
  8. Distribution: world
  9. Organization: Brigham Young University
  10. Lines: 29
  11.  
  12. In article <white.724729120@sfu.ca>, white@fraser.sfu.ca (Steve White) writes:
  13. > How do you duplicate an object without knowing its class?  We would like
  14. > to write something like
  15. >  
  16. > r = duplicate( p );
  17. >  
  18. > to get an object r of the same class and attributes as p.
  19. >  
  20. > We tried to write such a thing of our own using some combination of
  21. > sizeof, memmove, and Bless, but ran into a couple of problems.
  22. >  
  23. > The Think C Class Library Manual claims that 
  24. >  
  25. > sizeof( class_name )
  26. >  
  27. > will return the size of an object in a class.  We get "illegal use of
  28. > class type" when we try to compile, e.g., 
  29. >  
  30. > sizeof( Window )
  31.  
  32. If you read on page 62 of the C TCL manual, it says down by the bottom:
  33. "Sizeof operator not allowed
  34. You cannot use the sizeof operator to take the size of a class name or of an
  35. object. This use was allowed in THINK C 4.0"
  36.  
  37. Sorry for the bad news. :(
  38.  
  39. Seth Leigh
  40. BYU Physics Dept.
  41.