Thema: Delphi Array definition

Einzelnen Beitrag anzeigen

Cöster

Registriert seit: 6. Jun 2006
589 Beiträge
 
Turbo Delphi für Win32
 
#19

Re: Array definition

  Alt 24. Nov 2006, 18:21
Delphi-Quellcode:
type
  TIntArray = array of Integer;

  TMyClass = class
  private
    procedure SetSpaltenAnzahl(Anz: Integer);
    FTestArray: array of TIntArray; // 2D-Array. Entspricht array of array of Integer
    FSpaltenAnzahl: Integer;
    FZeilenAnzahl: Integer;
  public
    constructor Create;
    property SpaltenAnzahl: Integer read FSpaltenAnzahl write SetSpaltenAnzahl;
  end;

implementation

constructor TMyClass.Create;
begin
  inherited Create;
  FSpaltenAnzahl := 5;
  FZeilenAnzahl := 2;
  SetLength(FTestArray, 5, 2);
end;

procedure TMyClass.SetSpaltenAnzahl(Anz: Integer);
begin
  FSpaltenAnzahl := Anz;
  SetLength(FTestArray, Anz, FZeilenAnzahl);
end;
  Mit Zitat antworten Zitat