当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > C#中的函数重载

ASP.NET
Web服务器控件:LinkButton控件
Web服务器控件:ListBox控件
Web服务器控件:ListItem控件
Web服务器控件:Literal控件
Web服务器控件:Panel控件
Web服务器控件:PlaceHolder控件
Web服务器控件:RadioButton控件
Web服务器控件:RadioButtonList控件
Web服务器控件:BulletedList控件
Web服务器控件:Style控件
Web服务器控件:Table控件
Web服务器控件:TableCell控件
Web服务器控件:TableRow控件
Web服务器控件:TextBox控件
Web服务器控件:XML控件
Validation服务器控件:CompareValidator控件
Validation服务器控件:CustomValidator控件
Validation服务器控件:RangeValidator控件
Validation服务器控件:RegularExpressionValidator控件
Validation服务器控件:RequiredFieldValidator控件

ASP.NET 中的 C#中的函数重载


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 48 ::
收藏到网摘: n/a

http://www.asp888.net 豆腐技术站

我们以前在C++中曾经知道C++中有函数重载的概念,现在在ASp.Net的C#中我们仍然可以使用函数重载的
概念和定义:
假设我们在程序中定义了两个函数:String test(String str1) 而后 int test1(int i),他们的内容都是很
简单的功能
String test(String str1){
Response.Write("函数重载测试,这个是String函数");
Return "123232";
}
int test(int i){
Response.Write("函数重载测试,这个是int函数");
Return 1;
}
当我们调用 test("豆腐") 和 test(888),编译器非但不会报错,而且会执行出不同的结果,这样。
函数重载给我们在编程的过程中带来了很大的方便,我们可以由编译器来决定根据我们参数的变化相应的
执行不同的代码。而且 这个也是 面向对象编程的一个主要的特色之一。相信MS的确想让ASP.Net成为Web
未来编程的规范。