C#

Public struct S { public int V; public S(int v) { V = v; } } public class C { public int V; public C(int v) { V = v; } } public static void Main() { S s1 = new S(10), s2 = s1; s1.V = 20; C c1 = new C(10), c2 = c1; c1.V = 20; Console.WriteLine(s2.V); Console.WriteLine(c2.V); }
10 10
10 20
20 10
20 20
{"name":"C#", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"public struct S { public int V; public S(int v) { V = v; } } public class C { public int V; public C(int v) { V = v; } } public static void Main() { S s1 = new S(10), s2 = s1; s1.V = 20; C c1 = new C(10), c2 = c1; c1.V = 20; Console.WriteLine(s2.V); Console.WriteLine(c2.V); }","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker