Re: C Structs as objects?
Re: C Structs as objects?
- Subject: Re: C Structs as objects?
- From: Finlay Dobbie <email@hidden>
- Date: Wed, 17 Oct 2001 21:43:13 +0100
On Wednesday, October 17, 2001, at 09:52 pm, Ondra Cada wrote:
JLM> In C, IIRC, you could absolutely not assign a struct to a struct
simply
JLM> by saying
JLM>
JLM> destStruct = srcStruct;
You don't remember correctly. Assignment (and returning, which is much
more
complicated implementation-wise!!!) of structures (and unions,
incidentally)
was part of ANSI C for years.
Also note that you can't do destObj = srcObj to make it copy all of the
instance variables or anything... Since objects have to be dynamically
allocated, you are probably just assigning addresses to pointers.
-- Finlay