Esempio creo un tipo TabelloneTorneo per squadre generiche...
codice:
public class TabelloneTorneo<T> {
private T tipoPartecipante;
private String nome, data;
public TabelloneTorneo(T tipoPartecipante, String nome, String data){
this.tipoPartecipante = tipoPartecipante;
this.data = data;
this.nome = nome;
}
public T getTipoPartecipante(){
return tipoPartecipante;
}
}
T è un segnaposto per qualsiasi tipo di squadra ad esempio potrei inserirci SquadraCalcio, SquadraTennis, SquadraBasket. E' giusto il ragionamento?