This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Subtle problem with virtual keyword that can mislead the unwary...


>>>>> Skip Montanaro <montanaro@crd.GE.COM> writes:

> Now, I suspect all the C++ experts reading this are way ahead of me,
> thinking, "The problem's obvious. He forgot to declare B's destructor
> virtual."  Sure enough, adding the "virtual" keyword to the
> declaration of B::~B() cures the error.

Um, no.  The problem is that you didn't define ~B.  It is automatically
virtual because ~A is.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]