【发布时间】:2011-01-03 13:10:46
【问题描述】:
我尝试在 Delphi 2010(也在 XE 中)定义一个通用接口,并且(即使它编译)错误洞察抱怨语法。不幸的是,这也会破坏实现类的代码完成。所以我想知道这是IDE的错误还是我的想法错误;)
界面:
IValue <T> = interface
function GetValue : T;
procedure SetValue (Value : T);
end;
还有一个实现类:
TSomeClass = class (TInterfacedObject, IValue <string>, IValue <Integer>)
protected
function GetValue1 : string;
procedure SetValue1 (Value : string);
function GetValue2 : Integer;
procedure SetValue2 (Value : Integer);
function IValue <string>.GetValue = GetValue1; //from this point error insight complains
procedure IValue <string>.SetValue = SetValue1;
(*....*)
end;
如果我用Tstring 替换string 并定义TString = string 一切看起来都很好。有什么想法还是德尔福错误?
问候,
可可
【问题讨论】:
-
我在 QC#102293 下报告了类似问题(XE2 更新 3):qc.embarcadero.com/wc/qcmain.aspx?d=102293 * IDE Fix Pack 没有帮助
标签: delphi generics interface syntax-error