home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!destroyer!cs.ubc.ca!newsserver.sfu.ca!sfu.ca!white
- From: white@fraser.sfu.ca (Steve White)
- Subject: Duplicate Object in Think C?
- Message-ID: <white.724729120@sfu.ca>
- Sender: news@sfu.ca
- Organization: Simon Fraser University, Burnaby, B.C., Canada
- Date: Sat, 19 Dec 1992 01:38:40 GMT
- Lines: 23
-
- 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 )
-
- Is there some setting we're missing, or what? We're running v. 5.0.4.
-
- Is there some standard way of achieving the duplication of an object?
-
-