排球

类和结构的区别7z7z

2019-07-08 20:24:09来源:励志吧0次阅读

类和结构的区别,

类:类引用类型堆配类实例进行赋值复制引用都指向同段实际象配内存类构造析构函数类继承继承结构:结构值类型栈配(虽栈访问速度比较堆要快栈资源限放)结构赋值配产新象g[] args) { Point tmpPoint = new Point(1, 2, 3); PointGeometry tmpPG1 = new PointGeometry(tmpPoint); PointGeometry tmpPG2 = new PointGeometry(tmpPoint); tmpPG2.X = 4; tmpPG2.Y = 5; tmpPG2.Z = 6; //由于结构值类型tmpPG1 tmpPG2 坐标并 iteLine(tmpPG1); iteLine(tmpPG2); //由于类引用类型tmpPG1坐标修改影响tmpPG3 PointGeometry tmpPG3 = tmpPG1; tmpPG1.X = 7; tmpPG1.Y = 8; tmpPG1.Z = 9; iteLine(tmpPG1); iteLine(tmpPG3); adLine(); } }}结:X: 1, Y: 2, Z: 3X: 4, Y: 5, Z: 6X: 7, Y: 8, Z: 9X: 7, Y: 8, Z: 9继续努力!

怎样开微店铺
微信上怎么卖衣服
如何进行网站建设
分享到: