Why does this virtual destructor trigger an unresolved external?

前端 未结 7 1539
情书的邮戳
情书的邮戳 2021-02-19 03:43

Consider the following:

In X.h:

class X
{
    X();
    virtual ~X();
};

X.cpp:

#inclu         


        
相关标签:
7条回答
  • 2021-02-19 04:16

    You need to give a body to the virtual destructor:

    
    class X
    {
        X();
        virtual ~X() {}
    };
    
    0 讨论(0)
提交回复
热议问题