C# constructor execution order

后端 未结 7 971
渐次进展
渐次进展 2020-11-22 14:57

In C#, when you do

Class(Type param1, Type param2) : base(param1) 

is the constructor of the class executed first, and then the superclass

7条回答
  •  攒了一身酷
    2020-11-22 15:45

    Constructor mechanism is much better as it leaves the application to use constructor chaining and if you were to extend the application it enables through inheritance the ability to make minimal code changes. Jon Skeets Article

提交回复
热议问题