Destructor, and as a matter of good design all virtual methods, should be declared virtual only at the top of class inheritance hierarchy. You can think of it as a bad design or simply a mistake on programmer's part, if the destructor is declared virtual in the middle of a class inheritance hierarchy it can lead to undefined behavior. Here is an example:
struct A {
~A() { std::cout << "A "; }
};
struct B : public A {
// destructor is virtual from here
virtual ~B() { std::cout << "B "; }
};
struct C : public B {
~C() { std::cout << "C "; }
};
Create instance of C and delete it through base pointer:
A* aPtr = new C();
delete aPtr;
In what order the destructors would be invoked?