In this code:
TTest<IntfT: IInterface> = class
protected
fObj : TInterfacedObject;
public
function GetVal: IntfT;
end;
How would I implement the GetVal function if I want it to return fObj as an IntfT?
I've tried:
result := fObj as IntfT;
and
fObj.QueryInterface(IntfT,result);
and
result := fObj as IInterface;
but nothing seems to work. This seems like such a simple thing, I keep thinking I must be missing something.
Any ideas?
EDIT
What looks the most promising to me right now is QueryInterface. Currently the compiler complains that IntfT isn't a GUID and I get the impression that if I had the appropriate GUID everything would be happy. Anyone know of a way to get the IID from an interface type that would work in this situation?