Am 21.12.2019 um 16:49 schrieb Adriaan van Os:
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}
type
IMyInterface = interface
procedure P1;
end;
IMyInterface2 = interface
procedure P2;
end;
TMyClass = class(TInterfacedObject,
IMyInterface, IMyInterface2)
FI2 : IMyInterface2;
protected
procedure IMyInterface.P1 = MyP1;
procedure MyP1;
public
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.
Yes, this is by design, because the idea of the interface delegation is
that the class can be cast to the designated interface type (thus
supporting the interface) and then be used as if it directly implemented
the interface.
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 TMyClass.
I don't get what you're saying here. Would you please provide code that
illustrates your problem?
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal