Virtual Destructors

Hello everybody,

I understand the use of virtual destructors but i don't get why should one put the destructor of the derived class virtual:

why would this be wrong? :
1
2
3
4
class Base{
public:
virtual ~Base();
//some virtual methods 


1
2
3
4
class Derived: public Base{
public:
~Derived(); //this is not virtual
//Implementation of the virtual methods 


thank you in advance
If the destructor of the base class is virtual the destructor of the derived class will be virtual even if you don't use the virtual keyword.
aha okay.

thank you!!
Topic archived. No new replies allowed.