How to declare two inter-linked classes?

See Forward Declarations and Mutually Dependent Classes documentation.

type (* start type section - one unified section "to rule them all" *)
  TAsyncPopulator = class; (* forward declaration *)

  TThreadPopulator = class(TThread)
  private
    _owner:TASyncPopulator;
  end;

  TAsyncPopulator = class (* final declaration - WITHIN that very section where forward declaration was made *)
  private
    _updater: TThreadPopulator;
  end;

Use the source, Luke! Your Delphi installation has full VCL and RTL sources for you to read and watch and learn. And it uses this template a lot. Every time when you ask yourself "how I could do it", just think along "how did Borland do it" and pretty chance that you can already get a ready-made example in Delphi-provided sources.


Use this before any class definition. Forward class works in Delphi 2010. I don't know witch version of delphi you have but it's the only solution I can think off.

type   
 TAsyncPopulator = Class;

Hope I helped