Virtual destructors for interfaces.

Posted by wowus on Stack Overflow See other posts from Stack Overflow or by wowus
Published on 2010-06-03T20:09:02Z Indexed on 2010/06/03 20:14 UTC
Read the original article Hit count: 220

Filed under:

Do interfaces need a virtual destructor, or is the auto-generated one fine? For example, which of the following two code snippets is best, and why?

class Base
{
public:
    virtual void foo() = 0;
    virtual ~Base() {}
};

OR...

class Base
{
public:
    virtual void foo() = 0;
};

© Stack Overflow or respective owner

Related posts about c++