![]() |
Re: Array definition
das würde bedeuten ich müsste das so machen
Delphi-Quellcode:
type Daystore = array of string end; type TWorkingtable = class Test:Array of DayStore; public constructor Create ; end; |
Re: Array definition
Eher so:
Delphi-Quellcode:
type
Daystore = array of string; TWorkingtable = class Test:Array of DayStore; public constructor Create ; end; |
Re: Array definition
wieso kann ich dann im
Delphi-Quellcode:
nicht auf DayStore zugreifen, es steht mir bei setlength nich zu Verfügung.
constructor TWorkingtable.Create;
begin SetLength(DayStore,2); //<----- end; lg Bundy |
Re: Array definition
Weil der Member Test heißt ;-)
|
Re: Array definition
Mit SetLength nimmt man keine Änderung an einem Typen vor (Typen sind nach der Definition nicht mehr umdefinierbar), sondern an einer Variablen.
|
Re: Array definition
ahhhh jetzt hab ich es geschnallt :thumb:
das Sieht dann so aus
Delphi-Quellcode:
type
MyStore = Array of String; TWorkingtable = class DayStore : MyStore; Test:Array of DayStore; public constructor Create ; end; implementation constructor TWorkingtable.Create; begin SetLength(DayStore,2); end; |
Re: Array definition
Nenene. Nicht array of <Variablenname> sondern array of <Typbezeichner>
|
Re: Array definition
könntest du mir mit einen Code Sample aushelfen :wall:
|
Re: Array definition
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; |
Re: Array definition
danke dir :thumb:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:23 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz