Is there a use for making a protected destructor virtual?

后端 未结 4 1020
天命终不由人
天命终不由人 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:18

    Yes, if you intend to do delete this in class Parent member functions which is very common when implementing IUnknown::Release() in COM objects.

提交回复
热议问题