Inheritance and Destructors in C#

后端 未结 7 1009
灰色年华
灰色年华 2021-02-13 19:30

According to this, it states that Destructors cannot be inherited or overloaded. In my case, for all subclasses, the destructors will be identical. Is this pretty m

7条回答
  •  无人共我
    2021-02-13 19:49

    The finalizer you defined in A will be called when an instance of B is destroyed.

    If you define a finalizer in both A and B, the most specific finalizer (B) will run first, then the least specific (A).

提交回复
热议问题