home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mcsun!sunic!ericom!etn.ericsson.se!etn.ericsson.se!bjs
- From: bjs@etn.ericsson.se (Bj|rn S{ter|y 1342)
- Subject: Deleting NIHCL Objects
- Message-ID: <1992Sep9.110455.17143@etn.ericsson.se>
- Keywords: virtual destructors
- Sender: news@etn.ericsson.se
- Reply-To: bjs@etn.ericsson.se (Bj|rn S{ter|y 1342)
- Organization: Ericsson Telecom A/S
- Date: Wed, 9 Sep 92 11:04:55 GMT
- Lines: 32
-
- i have implemented a set making use of the NIHCL Set class,
- and several objects derived from the NIHCL class Object which
- are added to the set using the add(Object *) method.
-
- i soon found out that deleting the set though ~Set destructor
- did not delete the objects in the set. i therefore tried to
- iterate through the set deleting the objects in the set through
- the individual Object pointers. this did however not release the
- memory allocated by the derived objects, because the ~Object
- destructor is not virtual.
-
- most everything else about NIHCL seems very well designed, and i
- can accept the fact that deleting the Set not automatically deletes
- the individual objects, but the non virtual ~Object "feature" surprised
- me.
-
- i am hesitant to modify the NIHCL source code to make the ~Object
- virtual, due to any possible error that it might cause for other
- parts of the library.
-
- has anybody else seen/considered this "feature"?
- is it there for a good reason that i don't see?
- is it possible to "fix" (i.e. by just making the ~Object virtual)?
-
- regards,
- bjorn.
-
- ---------------------------------
- - Bjorn.Sateroy@etn.ericsson.se -
- - Ericsson Telecom AS, Norway -
- ---------------------------------
-
-