Why does this virtual destructor trigger an unresolved external?

前端 未结 7 1543
情书的邮戳
情书的邮戳 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() {}
    };
    

提交回复
热议问题