Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IFoo = interface
- ['{B1D9563D-8189-41C5-B2C5-AD1D52D83FE7}']
- end;
- IEnhancedFoo = interface(IFoo)
- ['{EC74B9B1-1189-4B46-A1EA-D5DF5ABDF55F}']
- end;
- IGeneric<T: IFoo> = interface
- end;
- ISpecialized = interface(IGeneric<IEnhancedFoo>)
- ['{57691F38-6F9C-4DBB-8A37-6C89147EB036}']
- end;
- TWhatever = class
- public
- constructor Create(const AGeneric: IGeneric<IFoo>);
- end;
- TImplementation = class(TInterfacedObject, ISpecialized);
- procedure Main;
- var
- intf: ISpecialized;
- begin
- intf := TImplementation.Create;
- TWhatever.Create(IGeneric<IFoo>(intf));
- TWhatever.Create(intf); // E2010 Incompatible types: 'Project2.IGeneric<Project2.IFoo>' and 'ISpecialized'
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement