Difference between new and override

后端 未结 14 1521
再見小時候
再見小時候 2020-11-22 05:36

Wondering what the difference is between the following:

Case 1: Base Class

public void DoIt();

Case 1: Inherited class

<         


        
14条回答
  •  再見小時候
    2020-11-22 05:52

    The article below is in vb.net but I think the explanation about new vs overrides is very easy to grasp.

    https://www.codeproject.com/articles/17477/the-dark-shadow-of-overrides

    At some point in the article, there is this sentence:

    In general, Shadows assumes the function associated with the type is invoked, while Overrides assumes the object implementation is executed.

    The accepted answer to this question is perfect but I think this article provide good examples to add better meaning about the differences between these two keywords.

提交回复
热议问题