Delphi: Interlink two dependent class in two separate unit - Type X is not yet completely defined -


i have 2 big class defined in 2 separated unit. there members in both class linked another. forward declaration not useful because classes not in same type block.

is there solution except merging two?

unit1:

uses    unit2;  type    tclassa = class      method1: tclassb;    end; 

unit2:

type    tclassa = class;      //type tclassa not yet defined    tclassb = class      method2: tclassa;    end;  implementation uses    unit1; 

is there solution except merging two?

no. unbreakable rule. if 2 types refer each other, , both need declared in interface section, must defined in same unit.


Comments