From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2a993df02f6d82f1 X-Google-Attributes: gid103376,public From: Hyman Rosen Subject: Re: More questions... Date: 1999/03/09 Message-ID: <36E59D1A.65ADB66E@prolifics.com>#1/1 X-Deja-AN: 453139717 Content-Transfer-Encoding: 7bit References: <7bvb4j$lt0$1@remarQ.com> <7c40uu$14lu@news3.newsguy.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@panix.com X-Trace: news.panix.com 921017581 13356 207.19.14.254 (9 Mar 1999 22:13:01 GMT) Organization: Prolifics Mime-Version: 1.0 NNTP-Posting-Date: 9 Mar 1999 22:13:01 GMT Newsgroups: comp.lang.ada Date: 1999-03-09T22:13:01+00:00 List-Id: Samuel Mize wrote: > OTOH, when you assign a new value to an object with a destructor, does > C++ call the destructor before assigning the new value? Or is that even > a meaningful question for C++? In C++ classes may have user-defined assignment operators. If a class has such a thing, then it is invoked when the assignment is done, and it is responsible for doing the necessary cleanup work. If a class does not have a user-defined assignment operator, then the default behavior is to treat assignment as a field-by-field copy, recursively invoking other user-defined assignment operators if fields are themselves class objects. Note that in C++, assigning to an object does not have the semantics of destroying the object and replacing it with a new one. The object is considered to be the same before and after the assignment. It merely has had its value changed in some fashion.