I have two classes, a child class:
type MyChildClass = class
public
parent: ^MyParent;
end;
And a parent class:
type MyParentClass = class
public
childs: array of ^MyChildClass;
end;
However, this wont work since only the class declared the last knows the other one. Example:
program Test;
interface
type MyChildClass = class
public
parent: ^MyParentClass;
end;
type MyParentClass = class
public
childs: array of ^MyChildClass;
end;
implementation
end.
This wont compile because the 7th line will throw the error "Undeclared identifier 'MyParentClass' as expected. Using abstract classes only solves the problem partially. Im really struggling on finding a solution. Maybe using interfaces would help?