[fpc-pascal] Interface type error
Ryan Joseph
genericptr at gmail.com
Sun Feb 2 03:29:39 CET 2020
Why doesn't this compile? IClassName2 descends from IClassName1 so shouldn't TClassName be compatible with IClassName1?
========================================
{$mode objfpc}
{$interfaces corba}
program test;
type
IClassName1 = interface
end;
IClassName2 = interface(IClassName1)
end;
type
TClassName = class(IClassName2)
end;
procedure Pass(int: IClassName1);
begin
end;
var
c: TClassName;
begin
// Incompatible type for arg no. 1: Got "TClassName", expected "IClassName1"
Pass(c);
end.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list