IEnumerator<T> inherits the IEnumerator interface. Both of them have the GetCurrent() method, and one of them is the usual method, and the second is the generics T method;
therefore, in your class you must implement both of them getCurrent():TObject (from IEnumerator ) and getCurrent():T (from IEnumerator<T> );
one small problem is that both methods have the same parameters, and you cannot just declare them both. therefore you should use aliases:
function getCurrentItem() : TElement; //actual method for IEnumerator<T> function GetCurrent():TObject; //method for IEnumerator function IMyList.GetCurrent = getCurrentItem; //alias
Take a look at the Method Permission Suggestion in docwiki http://docwiki.embarcadero.com/RADStudio/en/Implementing_Interfaces
therefore, in your case, the code should look like (I designated all the Abstract methods):
TElement = class(TObject) end; IMyList = interface(IEnumerator<TElement>) procedure Add(Element: TElement); end; TMyList = class(TInterfacedObject, IMyList ) private function getCurrentItem() : TElement; virtual; abstract; function IMyList.GetCurrent = getCurrentItem; function GetCurrent():TObject; virtual; abstract; function MoveNext(): Boolean; virtual; abstract; procedure Reset(); virtual; abstract; public property Current: TElement read GetCurrentItem; procedure Add(Element: TElement); virtual; abstract; end;
teran source share