1using System;
2
3
4public partial class _2fun_in1_class : System.Web.UI.Page
5{
6 public void Song()
7 {
8 Response.Write ("忘记你我做不到");
9 }
10 public void Song(string musicName)
11 {
12 Response.Write(musicName);
13 }
14
15
16 protected void Page_Load(object sender, EventArgs e)
17 {
18
19 string musicName = "还是觉得你最好";
20 Song("分手总要在雨天");
21 }
22}
23
这是一段网上的代码,自己修改了一下,通过试验发现,如果page_load中调用song函数的时候,如果带参数“分手总要在雨天”,就会输出改字符串“分手总要在雨天”,如果没有参数,即song();,那么就会输出“忘记你我做不到”
2
3
4public partial class _2fun_in1_class : System.Web.UI.Page
5{
6 public void Song()
7 {
8 Response.Write ("忘记你我做不到");
9 }
10 public void Song(string musicName)
11 {
12 Response.Write(musicName);
13 }
14
15
16 protected void Page_Load(object sender, EventArgs e)
17 {
18
19 string musicName = "还是觉得你最好";
20 Song("分手总要在雨天");
21 }
22}
23