[fpc-pascal] What happens when assigning interfaces?
Ryan Joseph
genericptr at gmail.com
Thu Jul 9 14:31:07 CEST 2020
Given the code below and the 2 cases can anyone explain what exactly the compiler does when the interfaces are assigned to? Does it copy a record like structure, call some internal functions, do runtime checks? I'm curious if they're doing more than I think they do.
============================
{$mode objfpc}
{$interfaces corba}
program unit_name;
type
IFoo = interface ['IFoo']
end;
type
TMyClass = class (IFoo)
end;
procedure DoSomething(i: IFoo);
begin
end;
var
f: IFoo;
c: TMyClass;
begin
// case A
f := c;
// case B
DoSomething(c);
end.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list