Difference between shadowing and overriding in C#?

后端 未结 6 892
面向向阳花
面向向阳花 2020-11-22 07:25

What\'s difference between shadowing and overriding a method in C#?

6条回答
  •  滥情空心
    2020-11-22 07:43

    Shadowing is a VB.NET concept. In C#, Shadowing is known as Hiding. It hides the derived class method. It is accomplished using the ‘new’ keyword.

    Override keyword is used to provide a completely new implementation of a base class method (which is marked ‘Virtual’) in the derived class.

提交回复
热议问题