我有一个与此类似的问题,但是在delphi中.
type
TThreadPopulator = class(TThread)
private
_owner:TASyncPopulator; //Undeclared identifier
end;
type
TAsyncPopulator = class
private
_updater: TThreadPopulator;
end;
Run Code Online (Sandbox Code Playgroud)
提到的问题的解决方案不适用于delphi
Ari*_*The 12
见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;
Run Code Online (Sandbox Code Playgroud)
使用来源,卢克!您的Delphi安装具有完整的VCL和RTL源,供您阅读,观看和学习.它经常使用这个模板.每次当你问自己"我怎么能做到"时,只要想想"Borland是怎么做的",而且很有可能你已经在Delphi提供的资源中得到了一个现成的例子.
归档时间: |
|
查看次数: |
6089 次 |
最近记录: |