public Grope(Grope g) { _student = new Student[g.Lenght]; int pos = -1; foreach (Student item in g) //// Просто так :) { ++pos; //// Просто так :) if (item is GoodStudent) //// Просто так :) { _student[pos] = (GoodStudent)item.Clone(); continue; } _student[pos] = (BadStudent)item.Clone(); } }
static void Main(string[] args) { Grope g = new Grope(new GoodStudent(true, Sex.Male, 187, "Sanya", "Pupkin", new bool[] { true, true, true }) , new BadStudent(false, Sex.Female, 145, "Katya", "Kakashkina", new bool[] { false, false, false })); PrintStudent.Print(g); //foreach (Student item in g) //{ // foreach (bool bitem in item) // { // Console.WriteLine(bitem); // } //} }