hi.
How do you is it illegal to define virtual destructors?
hi.
How do you is it illegal to define virtual destructors?
It is legal.
Code:virtual ~destr();
Not only it is legal, but it is good practice to declare the destructor of a polymorphic base class as virtual so as to avoid undefined behaviour should an object of a derived class be destroyed through a base class pointer.
You cannot declare constructors as virtual, but read this FAQ: What is a "virtual constructor"?Originally Posted by Samson144
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)