[fpc-devel] interfaces / inheritance / again -

Martin Frb lazarus at mfriebe.de
Mon Feb 2 20:01:37 CET 2026


  Not yet tested, but only matters if it is not going to be discontinued 
(in case it actually works)

I want a
   generic Foo <_A: SomeIntf;  _B: TBar>

such as that I can give an inherhited interface.

The interface has
   GetBar => which return TBar => or subclass....
Hence for the generic I have a param to specify the class.


But, I cans do
IFoo = interface
   proceduer GetBar: TBar;

ISubFoo = interface(Foo)
   proceduer GetBar: TSubBar;

However, (tests pending) if the below works, would it be working by 
indent? And therefore not removed by some bug fix in future?

IFoo = interface
   proceduer GetBar: TBar;
   property Bar: TBar;

ISubFoo = interface(Foo)
   proceduer GetSubBar: TSubBar;
   property Bar: TSubBar;


The property is just syntactic sugar isn't it?
But the generic would see it according to the actual type of the gen param.


More information about the fpc-devel mailing list