static void Main(string[] args) { Account[] a1 = new Account[3]; a1[0] = new saving("kailas", 10000); a1[1] = new current("prath", 0); a1[2] = new saving("ajay", 500); Array.Sort(a1, new Data_sort()); for (int i = 0; i < a1.Length; i++) { Console.WriteLine(a1[i].ToString()); } Console.ReadLine(); }
static void Main(string[] args) { Account[] a1 = new Account[3]; a1[0] = new saving("kailas", 10000); a1[1] = new current("prath", 0); a1[2] = new saving("ajay", 500); Array.Sort(a1, new Data_sort()); foreach (Account e in a1) { Console.WriteLine("name={0}", e.Name); } Console.ReadLine();; }