Article View: alt.comp.lang.learn.c-c++
Article #137Destructing encapsulated objects
From: Michael
Date: Fri, 26 Mar 1999 00:00
Date: Fri, 26 Mar 1999 00:00
18 lines
1855 bytes
1855 bytes
Hi all, I am running into some problems that are pretty general, but I'm not sure how to solve them. Basically they are like this: A parent window (or other generic object) has pointers-to several child windows (or other object). When a child window is deconstructed (pathway 1), it has to call a function foo() in the parent. However, when the parent is deconstructed first, and subsequenty calls the child's deconstructor (pathway 2), I don't want the child's deconstructor calling the parent's foo() function, because this is illegal (but it will compile) and definitely causes a crash. I tried moving the parent's function to ITS parent, but the same problem remains, just one level higher. I'm sure someone else has solved this problem. Any ideas? I'd like the child to know when NOT to call the parent function, i.e., the child should know when the PARENT is in ITS deconsructor, or better yet, some general solution to this problem. thanks ms
Technical Details
Message-ID:
<mKXK2.8237$_47.7309@news2.giganews.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f79ee,91ef7cab2cf22d,start X-Google-Attributes: gidf79ee,public X-Google-Thread: 10d4ba,91ef7cab2cf22d,start X-Google-Attributes: gid10d4ba,public X-Google-Thread: 109fba,91ef7cab2cf22d,start X-Google-Attributes: gid109fba,public X-Google-Thread: 114592,91ef7cab2cf22d,start X-Google-Attributes: gid114592,public From: "Michael" <&&schwager@u.arizona.edu> Subject: Destructing encapsulated objects Date: 1999/03/26 Message-ID: <mKXK2.8237$_47.7309@news2.giganews.com> X-Deja-AN: 459573104 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Trace: news2.giganews.com 922503186 208.164.98.153 (Fri, 26 Mar 1999 20:53:06 CDT) X-MSMail-Priority: Normal NNTP-Posting-Date: Fri, 26 Mar 1999 20:53:06 CDT Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++,it.comp.lang.c++