阴影VS在VB.NET超载 [英] Shadows vs Overloads in VB.NET
问题描述
当我们有新
在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.
这篇关于阴影VS在VB.NET超载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!