Hola,
A ver si esto puede servirte de algo. Si tienes alguna duda ya sabes que aquí hay gente dispuesta a echarte una mano.
Código Delphi
[-]
unit UTeam;
interface
type
TJugador = class
private
FNombre: string;
public
property Nombre: string read FNombre write FNombre;
end;
type
TArrayJugadores = array[0..19] of TJugador;
type
TTeam = class
private
FIndex: Byte;
FJugadores: TArrayJugadores;
public
constructor CreaTeam(AIndex: Byte; Jugadores: TArrayJugadores);
public
property Jugadores: TArrayJugadores read FJugadores;
end;
implementation
constructor TTeam.CreaTeam(AIndex : Byte; Jugadores: TArrayJugadores);
begin
inherited Create;
FIndex := AIndex;
FJugadores := Jugadores;
end;
Código Delphi
[-]
uses
UTeam;
procedure TForm1.Button1Click(Sender: TObject);
var
team: TTeam;
jugador1, jugador2: TJugador;
arrayJugadores: TArrayJugadores;
begin
jugador1 := TJugador.Create;
jugador1.Nombre := 'José Luis';
jugador2 := TJugador.Create;
jugador2.Nombre := 'Juan Carlos';
arrayJugadores[0] := jugador1;
arrayJugadores[1] := jugador2;
team := TTeam.CreaTeam(2, arrayJugadores);
try
ShowMessage(team.Jugadores[0].Nombre);
ShowMessage(team.Jugadores[1].Nombre);
finally
team.Free;
jugador1.Free;
jugador2.Free;
end;
end;