Human CreatePair(Human human, Sex gender) { if (human == null) { throw new ArgumentNullException(); } Human newHuman; if (human is Botan) { newHuman = CreateCoolParentPair(human as Botan); } else if (human is CoolParent) { newHuman = CreateBotanPair(human as CoolParent, gender); } else if (human is Student) { newHuman = CreateParentPair(human as Student); } else if (human is Parent) { newHuman = CreateStudentPair(human as Parent, gender); } else { throw new ArgumentNullException(); } Humans.Add(newHuman); return newHuman; }
public Human CreatePair(Human human) { if (human == null) { throw new ArgumentNullException(); } return CreatePair(human, RandomDataProvider.RandomGender()); }