home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!hamblin.math.byu.edu!yvax.byu.edu!physc1.byu.edu!seth
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Duplicate Object in Think C?
- Message-ID: <1992Dec19.002858.299@physc1.byu.edu>
- From: seth@physc1.byu.edu
- Date: 19 Dec 92 00:28:58 -0700
- References: <white.724729120@sfu.ca>
- Distribution: world
- Organization: Brigham Young University
- Lines: 29
-
- 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
- >
- > r = duplicate( p );
- >
- > to get an object r of the same class and attributes as p.
- >
- > We tried to write such a thing of our own using some combination of
- > sizeof, memmove, and Bless, but ran into a couple of problems.
- >
- > The Think C Class Library Manual claims that
- >
- > 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 )
-
- If you read on page 62 of the C TCL manual, it says down by the bottom:
- "Sizeof operator not allowed
- You cannot use the sizeof operator to take the size of a class name or of an
- object. This use was allowed in THINK C 4.0"
-
- Sorry for the bad news. :(
-
- Seth Leigh
- BYU Physics Dept.
-