Is there a use for making a protected destructor virtual?

后端 未结 4 1030
天命终不由人
天命终不由人 2021-01-11 15:46
/*Child is inherited from Parent*/
class Parent {  
  public:  
    Parent () //Constructor
    {
        cout << \"\\n Parent constructor called\\n\" <<         


        
4条回答
  •  不思量自难忘°
    2021-01-11 16:31

    protected: Base::~Base(); should be virtual at least if you (plan on) deleting any objects derived from Base within Base or a derived class of Base.

提交回复
热议问题