What is the output from the following code
using System; struct Point { int x; int y; public Point (int x) { this.x = x; } } class MainClass{ public static void Main(string[] args){ Point p1 = new Point (); Point p2 = new Point (1, 1); Console.WriteLine(p1.x); Console.WriteLine(p2.x); } }
// Illegal: must assign field y
When you define a struct constructor, you must explicitly assign every field.