What is the output of the following code snippet?
public class MyClass { public int X { get; set; } }
public struct MyStruct { public int X { get; set; } }
class Program { static void Main(string[] args) { MyClass classObj1 = new MyClass(); classObj1.X=12; MyClass classObj2 = classObj1; classObj2.X = 15; Console.WriteLine(classObj1.X); Console.WriteLine(classObj2.X); MyStruct structObj1 = new MyStruct(); structObj1.X = 12; MyStruct structObj2 = structObj1; structObj2.X=15; Console.WriteLine(structObj1.X); Console.WriteLine(structObj2.X); Console.ReadLine(); } }
Correct Answer: 15 15 12 15
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More C# MCQ Questions