static void Main(string[] args) { account[] arr = new account[3]; arr[0] = new saving("xyz", 30000); arr[1] = new current("pqr", 80000); arr[2] = new saving("lmn", 90000); for (int i = 0; i < 3; i++) { Console.WriteLine(arr[i]); } Console.WriteLine("\n\n"); arr[1].deposit(20000); arr[1].withdraw(200); arr[2].deposit(1000); // arr[2].withdraw(90500); Array.Sort(arr, new udsort()); for (int i = 0; i < 3; i++) { Console.WriteLine(arr[i]); } }