为什么要执行以下代码:
TYPE
TFmxObjHelper = CLASS HELPER FOR TFmxObject
FUNCTION GetInterface<T:IInterface> : T;
END;
FUNCTION TFmxObjHelper.GetInterface<T> : T;
BEGIN
IF NOT Supports(Self,T,Result) THEN Result:=NIL // Error on this line
END;
产生E2250 There is no overloaded version of 'Supports' that can be called with these arguments
吗?
又应该如何编写才能使“ GetInterface
”方法返回指定的接口(如果对象实现了该接口)或NIL(如果该对象没有实现)呢?