I've been working with a 3rd party service for the last couple days in Delphi XE2, and just about have it done. I'm running into a a problem that is absolutely stumping me that I think should have very obvious answers. I'm hoping another set of eyes can tell me what my problem is.
I have this interface:
IWorshipTeamEvent = Interface(IInterface)
function GetId : integer;
function GetName : string;
function GetTeamId : integer;
function GetStartDate : TDate;
function GetEndDate : TDate;
function GetStartTime : TTime;
function GetEndTime : TTime;
function GetSets : IWorshipTeamSetList;
property Id : integer read GetId;
property Name : string read GetName;
property TeamId : integer read GetTeamId;
property StartDate : TDate read GetStartDate;
property EndDate : TDate read GetEndDate;
property StartTime : TTime read GetStartTime;
property EndTime : TTime read GetEndTime;
property Sets : IWorshipTeamSetList read GetSets;
end;
Then in another class in the same unit, I'm trying to return a IWorshipTeamEvent in this function:
function TWorshipTeamEventList.GetEvent(index: Integer) : IWorshipTeamEvent;
begin
//fEvents is a TInterfaceList that contains only IWorshipTeamEvents
Result := fEvents[index] as IWorshipTeamEvent;
end;
At this point, I got the compiler error Operator not applicable to this operand type. I've tried a few things, like creating a temp variable with the type of IXmlResponseType and going
temp := fEvents[index] as IXmlResponseType;
Result := nil;
which compiled, so I tried creating temp with a type of IWorshipTeamEvent and going
temp := fEvents[index] as IWorshipTeamEvent;
Result := nil;
which did not compile.
Any suggestions are greatly appreciated