If I have the below code, I can pass an object that has I1 (TFoo if uncommented) to the test function

I can also pass an inherited interface. "x1: i2"

But I can not pass a call that only has the inherited interface?
 Error: Class "TFoo" does not implement interface "I1"

Is that intended?

Since TFoo implement I2, it does also implement I1.



program Project1;
{$Mode objfpc}
{$Interfaces CORBA}

type
  I1 = interface
    function Get1: byte;
  end;

  I2 = interface(I1)
    function Get2: byte;
  end;

  TFoo = class(TObject, I2)
  //TFoo = class(TObject, I2, I1)
    function Get1: byte; virtual; abstract;
    function Get2: byte; virtual; abstract;
  end;

  procedure test(a: I1);
  begin
  end;

var
x1: i2;
x2: TFoo;
begin
  test(x1);
  test(x2);
end.

_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to