hi.
How do you is it illegal to define virtual destructors?
Printable View
hi.
How do you is it illegal to define virtual destructors?
It is legal.
Code:virtual ~destr();
thanks and what about constructors?
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"?Quote:
Originally Posted by Samson144
thanks thanks thanks