public bool AltaSeleccion(SeleccionFutbol s1) { if (participantes.Count < 30) { if (s1.GetType().Name == "Entrenador" && Entrenador.GetContEntr() < 2) { return(true); } else if (s1.GetType().Name == "Masajista" && Masajista.GetContMas() < 4) { return(true); } else if (s1.GetType().Name == "Futbolista") { return(true); } Console.WriteLine("no hay capacidad para más participantes del tipo " + s1.GetType().Name + " en la selección de " + GetNombrePais()); return(false); } else { return(false); } }
//*************************** METODOS ******************************* public void AñadirPartic(SeleccionFutbol s1) { if (AltaSeleccion(s1)) { if (s1.GetType().Name == "Futbolista") { contFut++; } else if (s1.GetType().Name == "Masajista") { contMas++; } else if (s1.GetType().Name == "Entrenador") { contEntr++; } } Console.WriteLine("El miembro de la seleccion " + s1.GetType().Name + " ha sido añadido."); participantes.Add(s1); }