[fpc-devel] Question on interface inheritance...
Martin Frb
lazarus at mfriebe.de
Sun Feb 1 16:50:53 CET 2026
On 01/02/2026 16:34, Mattias Gaertner via fpc-devel wrote:
>
> On 2/1/26 15:51, Martin Frb via fpc-devel wrote:
>>
>> Or do you mean, the act of reintroduction, rather than the keyword?
>
> I think the compiler should not allow reintroducing in interfaces.
>
> In Delphi you get the same problem, stopping with
>
> TIntfBarBase.GetFoo is not implemented
>
Ok, lets see what other think / it wont help for now either, since it
wont work with the current compiler.
But I do think that (other than the work for the compiler devs) it would
be a neat feature.
Though, probably only if the reintroduced version returns a subclass of
the original
IFaceBase
GetFoo: TFooBase;
IFace(IFaceBase)
GetFoo: TFoo;
Since TFoo inherits from TFooBase the new interface still 100% fulfils
the contract of the base.
Technically the interfaces still work even if the types are non
compatible (since the method of the base interface still exists in the
inherited, it only can't be accessed directly)
More information about the fpc-devel
mailing list