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

前端 未结 7 1532
轮回少年
轮回少年 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条回答
  •  -上瘾入骨i
    2021-01-31 07:47

    Yes, by inheriting from a base class with a virtual destructor. In this case, you already pay the price for a polymorphic class (e.g. vtable).

提交回复
热议问题