public Connection(Entity parent, TypeOfConnection type, Entity child) { Parent = parent; Child = child; Type = type; parent.Connections.Add(this); }
public string GetAnswer(Entity parent, TypeOfConnection type_of_c, Entity child) { foreach (Connection connection in parent.Connections) { if (connection.Type == type_of_c) { if (connection.Child == child) { return("да"); } else if (GetAnswer(connection.Child, type_of_c, child) == "да") { return("да"); } } } return("нет"); }