public static void Main() { Shop sh = new Shop(3); sh[0] = new Laptop("Samsung", 5200); sh[1] = new Laptop("Asus", 4700); sh[2] = new Laptop("LG", 4300); try { foreach (Laptop LT in sh) Console.WriteLine(LT.ToString()); } catch (System.NullReferenceException) { } Console.WriteLine(); }
public static void Main() { Shop sh = new Shop(3); sh[0] = new Laptop("Samsung", 5200); sh[1] = new Laptop("Asus", 4700); sh[2] = new Laptop("LG", 4300); try { foreach (Laptop LT in sh) { Console.WriteLine(LT.ToString()); } } catch (System.NullReferenceException) { } Console.WriteLine(); }