Hi
I have this class defined:
type
SectionNodePTR = ^NodeStruct;
NodeStruct = packed record
rendObj : Variant;
ID : Integer;
Parent : SectionNodePTR;
Children : Array of SectionNodePTR;
end;
markedDocumentBranch = class
public
documentBranch : NodeStruct;
i : Integer;
constructor Create();
procedure AppendNode (var ChildNodeObj : NodeStruct; var location : integer);
procedure AppendMultipleNodes (var ChildNodeObjects : Array of NodeStruct; var location : integer );
end;
The constructor is defined as:
constructor markedDocumentBranch.Create;
begin
i := 10;
end;
All this is saved in a file
TDocument.pasNow, in
unit.pas, the main program, I call:
currBranch : TDocument.markedDocumentBranch;
This works.
Now, I want to create new
TDocument.markedDocumentBranch objects over a loop.
If I write in the loop body:
currBranch = TDocument.markedDocumentBranch.Create;
Then i get an error: Illegal Expression. No other message is given.
My goal is to create instances of the class in a loop and insert them in a dynamic array.
How can I solve this please
System : Linux glassplanet 6.1.8-1-cachyos #1 SMP PREEMPT_DYNAMIC Tue, 24 Jan 2023 10:53:24 +0000 x86_64 GNU/Linux
Lazarus 2.2.4 (rev Unknown) FPC 3.2.2 x86_64-linux-qt5