虚方法,但非虚析构函数

时间:2017-10-07 05:14:37

标签: c++ inheritance polymorphism virtual destructor

class A {
public:
    virtual void x() = 0;
    virtual void y() = 0;
    virtual int z() = 0;
};

class B: public A {
public:
    void x();
    void y();
    int z();
    void w();
};

class C: public A {
public:
    void x();
    void y();
    int z();
};

Class'i'有虚方法'j'但是非虚析构函数”,其中i = A,B C和j = x,y,z

我需要虚拟析构函数吗?

0 个答案:

没有答案