[fpc-pascal] Interface delegates and the implements property specifier

Adriaan van Os fpc at microbizz.nl
Sat Dec 21 16:49:00 CET 2019

Section 7.4 Interface delegation 
<https://www.freepascal.org/docs-html/current/ref/refse45.html#x98-1200007.4> of the FPC Language 
Reference Guide discusses interface delegates and the implements property specifier.

For example

$interfaces corba}
   IMyInterface = interface
     procedure P1;

   IMyInterface2 = interface
     procedure P2;

   TMyClass = class(TInterfacedObject,
                    IMyInterface, IMyInterface2)
     FI2 : IMyInterface2;
     procedure IMyInterface.P1 = MyP1;
     procedure MyP1;
     property MyInterface: IMyInterface2
        read FI2 implements IMyInterface2;

I had hoped that procedure IMyInterface2.P2 would now be visible as a method of TMyClass. This 
would be quite helpful in implementing multiple-inheritance. But no, the implements specifier 
completely hides it. I assume this has been discussed before.

However (after adding an identifying string to IMyInterface and IMyInterface2), 
TObject.GetInterface( IMyInterface2) fails for the FI2 delegate but succeeds for an object of 
TMyClass. This seems contradictory, as IMyInterface2 is really part of the F12 delegate, not of 


Adriaan van Os

More information about the fpc-pascal mailing list