hi.
How do you is it illegal to define virtual destructors?
This is a discussion on Destructor as a virtual within the C++ Programming forums, part of the General Programming Boards category; 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();
I never put signature, but I decided to make an exception.
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
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way