VB.Net 中是否需要“Overloads"关键字? [英] Is the 'Overloads' keyword ever required in VB.Net?

查看:38
本文介绍了VB.Net 中是否需要“Overloads"关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说.从我在网上看到的 Overloads 关键字是可选的,但有没有必要的时候?甚至在模块中使用时似乎是错误的.

As the title says. From what I can see online the Overloads keyword is optional but is there ever a time when it is necessary? It even seems to be an error when used in a Module.

推荐答案

不,这不是必需的.您可以在没有 Overloads 关键字的情况下重载方法和属性.

No, it's not neccessary. You can overload methods and properties without the Overloads keyword.

但是,如果在方法的一个重载上使用 OverloadsOverrides 关键字,则必须在类中对该方法的所有其他重载上使用它.

However, if you use the Overloads or Overrides keyword on one overload of a method, you have to use it on all other overloads to that method in the class.

您可以使用 Overloads 关键字代替 Shadows 关键字来隐藏具有相同签名的继承方法.然后你必须使用其中一个关键字,它们不是可选的.

You can use the Overloads keyword instead of the Shadows keyword to shadow an inherited method with the same signature. Then you have to use either of the keywords, they are not both optional.

这篇关于VB.Net 中是否需要“Overloads"关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆