Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

FPC interfaces bug

By: a guest on Aug 27th, 2011  |  syntax: Delphi  |  size: 0.78 KB  |  hits: 63  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. program fpc_bug;
  2. {$mode objfpc}
  3. {$interfaces CORBA}
  4. uses Variants;
  5.  
  6. type
  7. IInterfaceA = interface
  8.   procedure Afunction( x : byte );
  9. end;
  10.  
  11. IInterfaceB = interface
  12.   procedure Bfunction( s : AnsiString );
  13. end;
  14.  
  15. TBaseObject = class(IInterfaceA)
  16.   procedure Afunction( x : byte ); // implemented from IInterfaceA
  17. end;
  18.  
  19. TOtherObject = class(TBaseObject, IInterfaceB)
  20.   procedure Bfunction( s : AnsiString ); // implemented from IInterfaceB
  21. end;
  22.  
  23. procedure TBaseObject.Afunction( x : byte );
  24. begin
  25.   Writeln('TBaseObject : ', x );
  26. end;
  27.  
  28. procedure TOtherObject.Bfunction( s : AnsiString );
  29. begin
  30.   Writeln('TOtherObject : ', s );
  31. end;
  32.  
  33. var oo : TOtherObject;
  34.     o  : TObject;
  35. begin
  36.   oo := TOtherObject.Create;
  37.   o := oo;
  38.   (o as IInterfaceA).AFunction(42);
  39. end.