我有一个类似于
this的问题,但是在delphi中.
type TThreadPopulator = class(TThread) private _owner:TASyncPopulator; //Undeclared identifier end; type TAsyncPopulator = class private _updater: TThreadPopulator; end;
提到的问题的解决方案不适用于delphi
解决方法
请参见
Forward Declarations and Mutually Dependent Classes
文档.
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;
使用来源,卢克!您的Delphi安装具有完整的VCL和RTL源,供您阅读,观看和学习.它经常使用这个模板.每次当你问自己“我怎么能做到”时,只要想想“Borland是怎么做的”,而且很有可能你已经在Delphi提供的资源中得到了一个现成的例子.