课程视频:
课程点:
找出为什么第二个对象修改值后,原本的对象也被修改的根本原因
[C#] 纯文本查看 复制代码 //值类型 修改的都是变量地址上的数据
//int i = 0;
//i = 5;
//i = 10;
//i = 20;
//引用类型 每次修改,都是重新分配内存空间
//string str = "";
//str = "1";
//str = "12";
//str = "123";
//str = "1234";
Msdn5 msdn5 = new Msdn5();
msdn5.WebName = "玄机论坛";
msdn5.WebAddress = "bbs.msdn5.com";
msdn5.Age = 2;
// m = msdn5
//这样是在完整的拷贝 相当于 "快捷方式"
//Msdn5 m = msdn5;
//m.WebName = "君临网";
//m.WebAddress = "www.msdn5.com";
//m.Age = 10;
Msdn5 m = new Msdn5();
m.WebName = msdn5.WebName;
m.WebAddress = msdn5.WebAddress;
m.Age = msdn5.Age;
m.Age = 20;
m.WebName = "君临网";
m.WebAddress = "www.msdn5.com";
课程资源与视频下载地址:
http://pan.baidu.com/s/1gdF5vVH 密码:5nvv
|