[fpc-devel] interfaces / inheritance / again

Martin Frb lazarus at mfriebe.de
Tue Feb 3 01:06:56 CET 2026


On 03/02/2026 00:59, Martin Frb via fpc-devel wrote:
>
>
> If I drop the constraints, then I can just use independent interfaces...
> But then still, each interface has a
>   function    GetItem: TSomeType;  // diff type for each interface
>
> And the generic will call that GetItem, on all of them. Not much 
> difference.
>

I could probably just have

function Item: IBaseIntf

and return the inherited inteface as IBaseIntf, and on the receiving end 
(in the generic, and other code) typecast it back...
(not tested, but should work).

But then I can also just drop the constraints...
I am trying to ditch as little of the available type as possible.


More information about the fpc-devel mailing list