我经常得到:我在另一个单元中定义的接口类型的未声明标识符. 这是我有的: unit Drawers;interfaceimplementationtype IDrawer = interface ['{070B4742-89C6-4A69-80E2-9441F170F876}'] procedure Draw(); end;end. unit
这是我有的:
unit Drawers; interface implementation type IDrawer = interface ['{070B4742-89C6-4A69-80E2-9441F170F876}'] procedure Draw(); end; end.
unit Field; interface uses Graphics, Classes, Drawers; TField = class(TInterfacedObject, IField) private FSymbolDrawer: IDrawer;
在FSymbolDrawer我得到编译器错误.
当然我有抽屉用途;在定义TField的单元中.
这是关于什么的?
谢谢
在单位抽屉中,IDrawer的类型声明必须位于单元的接口部分.您已将其插入到实现部分中,它仅对单元内声明可见.这是代码:
unit Drawers; interface type IDrawer = interface ['{070B4742-89C6-4A69-80E2-9441F170F876}'] procedure Draw(); end; implementation end.