I가 2 개 인터페이스 ..인터페이스를 사용하여 객체 목록을 반환하는 방법은 무엇입니까?
IInterfaceA = interface
.....
End;
IInterfaceB = interface
['{834D7063-AE8F-40BF-B1E7-E0806EB991C7}']
Function getA (A: Integer): IInterfaceA;
Function getList: TList <IInterfaceA>;
End;
TClassA = class (TInterfacedObject, IInterfaceA)
....
End
TClassB = class (TInterfacedObject, IInterfaceB)
Function getA (A: Integer): IInterfaceA;
Function getList: TList <IInterfaceA>;
End;
// It works
Function TClassB.getA (A: Integer): IInterfaceA;
Begin
Result: = Manager.Find <TClassA> .Add (Linq.Eq ('fieldxxx', A.ToString).) UniqueResult;
End;
이 작동하지 않음 다음이 오류 발생 :
E2010 Incompatible types:
'System.Generics.Collections.TList <IInterfaceA>'
and'System.Generics.Collections.TObjectList <TClassB>'
Function TClassB.getList: TList <IInterfaceA>;
Begin
// The TClassA class implements the interface IInterfaceA
Result: = Manager.Find <TClassA> .List;
End;
내가 어떻게 해결합니까를?
코드가 충분하지 않습니다. 우리는 MCVE를 가질 수 없습니까? 오류 메시지가 분명해 보입니다. 그것이 무엇을 말하고 있는지 이해하십니까? –
충분한 코드가 보이지 않습니다. 'Manager.Find'는 어떤 타입을 반환합니까? –
오류 메시지는 유형이 무엇인지 알려줍니다. 오류 메시지는 정말 분명합니다. 때때로 사람들은 그것을 읽지 않습니다. –