In the following example:
class A {
public:
virtual ~A() { std::cout << "~A" << std::endl; }
};
class B : public A {
public:
virtual ~B() override { std::cout << "~B" << std::endl; }
};
class C : public B {
public:
~C() override { std::cout << "~C" << std::endl; }
};
clang-tidy
gives the following warning for class B
:
'virtual' is redundant since this function is already declared 'override'
Removing the virtual
keyword from class B
seems to allow all destructors in the chain to be called, but I want to make sure that I'm not missing anything.