阴影VS在VB.NET超载阴影、VS、NET、VB

2023-09-02 20:49:04 作者:小红书名字取什么好 小红书什么名字吸引人

当我们有在C#中,那个人我只看到作为一种变通方法来覆盖属性不具有虚拟/重写的声明,在VB.NET我们有两个概念阴影重载

When we have new in C#, that personally I see only as a workaround to override a property that does not have a virtual/overridable declaration, in VB.NET we have two "concepts" Shadows and Overloads.

在这种情况下,preFER一个到另一个?

In which case prefer one to another?

推荐答案

有三个密切相关的概念;覆盖,遮蔽和超载。

There are three closely related concepts; overriding, shadowing and overloading.

重写是当你犯了一个新的实现的虚方法。

Overriding is when you make a new implementation for a virtual method.

遮蔽是当你犯了一个新的非虚拟实现的方法。

Shadowing is when you make a new non-virtual implementation for a method.

重载是当您使用相同的名称但不同的参数添加一个方法。

Overloading is when you add a method with the same name but different parameters.

这三个概念都可以在这两个C#和VB。

All three concepts are available both in C# and VB.

 
精彩推荐
图片推荐