static void Main() { CopyConConstructor CC2 = new CopyConConstructor(10); CC2.Display(); CopyConConstructor CC3 = new CopyConConstructor(CC2); CC3.Display(); CopyConConstructor CC1 = new CopyConConstructor(); Console.WriteLine("Main Method Executed"); /*Output Order * 1.Static Constructor * 2.non-Static Constructors (Parameterized Constructor) * 2.non-Static Constructors (Copy Constructor) * 3.Default Constructor * 4.Main Method */ Console.ReadLine(); }
public CopyConConstructor(CopyConConstructor obj) // Copy Constructor { x = obj.x; }