static void Main() { Person men = new Person(), kid = new Person(), kid2 = new Person(); men.Name = "123Bob!"; men.Age = 25; Console.WriteLine(men.Name); kid.Age = 10; kid.Name = "Vik"; kid2.Age = 12; kid2.Name = "Lux"; men.AddKid(kid); men.AddKid(kid2); List<String> names = men.GetKidsNames(); byte age = men.GetChildAgeByName(names.First()); Console.ReadKey(); }
// добавление ребенка public void AddKid(Person kid) { _kidsList.Add(kid); _kidsCount += 1; }