Yes I have seen a lots of posts about using the keywords virtual and override for destructors in C++. I also think I understand the usage:
- if a base class has a virtual destructor and a derived class overrides it, if the signatures are different, the program will not compile due to override.
However I am wondering - or I have seen it also several times in someones code, that it is used like this:
class Base
{
public:
~Base();
};
class Derived : public Base
{
public:
~Derived() override;
};
Does this override on a destructor of a non-virtual function in the base class actually has any impact on the program / compiling or anything? Or is it just used wrongly in that case?
error: 'Derived::~Derived()' marked 'override', but does not override
– Evg