Can the default destructor be generated as a virtual destructor automatically?

前端 未结 7 1526
轮回少年
轮回少年 2021-01-31 07:30

Can the default destructor be generated as a virtual destructor automatically?

If I define a base class but no default destructor, is there a default virtual destructor

7条回答
  •  清酒与你
    2021-01-31 07:52

    Currently, Uri is right. On the other hand, after you have declared a virtual method in your class, you are paying the price for the existence of the virtual table anyway. In fact, the compiler will warn you if your class has a virtual method, but no virtual destructor. This could become a candidate for automatic generation of the default virtual destructor instead of the pesky warning.

提交回复
热议问题