InterviewQuestion_C#_程序题_004

2021-09-17 09:12

阅读:717

标签:png   es2017   image   sys   blog   代码   class   str   技术   分析代码,写出程序输出结果: 文件:Class1.cs using System; namespace Interview3 { class Class1 { private string str = "Class1.str"; private int i = 0; static void StringConvert(string str) { str ="string being converted."; } static void StringConvert(Class1 c) { c.str ="string being converted."; } static void Add(int i) { i++; } static void AddWithRef(ref int i) { i++; } static void Main() { int i1 = 10; int i2 = 20; string str = "str"; Class1 c = new Class1(); Add(i1); AddWithRef(ref i2); Add(c.i); StringConvert(str); StringConvert(c); Console.WriteLine(i1); Console.WriteLine(i2); Console.WriteLine(c.i); Console.WriteLine(str); Console.WriteLine(c.str); Console.ReadKey(); } } } 输出结果:  InterviewQuestion_C#_程序题_004标签:png   es2017   image   sys   blog   代码   class   str   技术   原文地址:http://www.cnblogs.com/jswl/p/7420783.html


评论


亲,登录后才可以留言!