静态方法可以在C#中重载吗? [英] static method can be overloaded in c#?

查看:114
本文介绍了静态方法可以在C#中重载吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


是否可以在C#中重载静态方法?

谢谢与问候
Sairam Bhat

解决方案

请简短说明一下Pritesh的正确答案.

重载没有什么特别的(与重载不同).这只是对不同方法使用相同的名称,仅此而已.它依赖于编译器根据参数的数量和类型来区分不同方法的能力(这并不总是可能的,但随后会出现编译时错误).

这样,静态或非静态的确有任何区别.

—SA


可以超载
静态方法,但
不可能覆盖它...........
谢谢.......


希望获得帮助:

http://blogs.msdn.com/b/kirillosenkov/archive/2008/02/06/how-to-override-static-methods.aspx [ 解决方案

Just a short clarification on the correct Answer by Pritesh.

Overloading is nothing special (unlike overriding). This is just having the same name to different methods, nothing else. It relies on the ability of the compiler to tell the different methods by number and types of arguments (which is not always possible, but then the compile-time error comes to help).

In this way, static or non-static does make any difference.

—SA


Ya it is possible to Overload
Static methods but
it can''t possible to be override it..........
Thanks.......


hope this help :

http://blogs.msdn.com/b/kirillosenkov/archive/2008/02/06/how-to-override-static-methods.aspx[^]


这篇关于静态方法可以在C#中重载吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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