Advertisement
Guest User

FPC interfaces bug

a guest
Aug 27th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.78 KB | None | 0 0
  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.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement