为了简化,我只有两个类TParent
和TChild
。
TParent = class
protected
FValue : Integer;
end;
TChild = class(TParent)
public
property Value : Integer read FValue;
end;
如果
TChild
属性的Value
使用了另一个单元中的TParent
变量FValue
,当使用自动完成时,IDE将始终创建新的变量,这样在添加新属性或方法时可能会导致意外错误,并且这是个问题。TChild = class(TParent)
private
FValue: Integer;
public
property Value : Integer read FValue;
end;
然而,如果TParent
和TChild
在同一个单元中,一切都正常。如果我没有将两个类移动到同一个单元的能力,有没有办法防止这种情况发生?另外,我也无法访问包含TParent
的单元。在这种情况下,TChild
是从TCustomGrid
继承的组件。