Will the destructor of the base class called if an object throws an exception in the constructor?

前端 未结 4 849
失恋的感觉
失恋的感觉 2021-01-07 23:08

Will the destructor of the base class be called if an object throws an exception in the constructor?

4条回答
  •  粉色の甜心
    2021-01-07 23:45

    From Standard docs, 15.3 - 11,

    The fully constructed base classes and members of an object shall be destroyed before entering the handler of a function try- block of a constructor or destructor for that object.

提交回复
热议问题