[fpc-pascal] Explicit Interface implementation and inheritance

Jean SUZINEAU jean.suzineau at wanadoo.fr
Sun Aug 15 07:53:27 CEST 2021


Le 15/08/2021 à 00:43, Dmitry Boyarintsev via fpc-pascal a écrit :
> Why is interface implementation not inherited, if explicit 
> implementation is used.

I guess this is because you can implement an interface through 
delegation too:

https://www.freepascal.org/docs-html/ref/refse48.html

type
   IMyInterface = interface
     procedure P1;
   end;

   TMyClass = class(TInterfacedObject, IMyInterface)
   private
     FMyInterface: IMyInterface; // interface type
   public
     property MyInterface: IMyInterface
        read FMyInterface implements IMyInterface;
   end;




More information about the fpc-pascal mailing list