home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!po.CWRU.Edu!esw
- From: esw@po.CWRU.Edu (Eric S. Wallace)
- Newsgroups: comp.lang.c++
- Subject: virtual destructor warning
- Date: 6 Sep 1992 18:09:14 GMT
- Organization: Case Western Reserve University, Cleveland, Ohio (USA)
- Lines: 35
- Message-ID: <18dhgaINN4r7@usenet.INS.CWRU.Edu>
- NNTP-Posting-Host: thor.ins.cwru.edu
-
-
- I have some classes in the following relationship:
-
- class ibuf {
- public:
- ibuf(int);
- ~ibuf(void) { /* ... */ }
- };
-
- class obuf {
- public:
- obuf(int);
- ~obuf(void) { /* ... */ }
- };
-
- class iobuf : public obuf, public ibuf {
- public:
- iobuf(int, int);
- };
-
- When compiling with gcc-2.2.2, I get the following warning:
-
- destructor `ibuf::~ibuf()' non-virtual in relationship `iobuf: ibuf'
-
- The warning occurs for whatever class is listed last in the list of base
- classes for iobuf. It was my understanding that if a derived class had no
- explicit destructor, a default one would be created that destructed each
- base class in the reverse order they appear in the list. Is this not the
- case? Why would ibuf::~ibuf have to be virtual?
-
- Thanks in advance,
-
- Eric Wallace
- wallace@chezmoto.ai.mit.edu
- esw@po.cwru.edu
-