tw15303.pp 805 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. { %fail }
  2. program project1;
  3. {$ifdef fpc}{$mode objfpc}{$H+}{$endif}
  4. type
  5. IIntf1 = interface['{484A7AC5-114E-4D99-9E4F-7B4906413B2F}'] end;
  6. IIntf2 = interface['{3718A1FC-A6F6-4465-965D-14FF1CBA1902}']
  7. procedure Print2;
  8. end;
  9. TClass2 = class(TInterfacedObject, IIntf2)
  10. procedure Print2;
  11. end;
  12. TClass1 = class(TInterfacedObject, IIntf1, IIntf2)
  13. private
  14. FIntf2:IIntf2;
  15. function GetIntf2:IIntf2;cdecl; // <--- should be forbidden
  16. public
  17. constructor Create;
  18. property I:IIntf2 read GetIntf2 implements IIntf2;
  19. end;
  20. procedure TClass2.Print2;
  21. begin
  22. Writeln('doing something');
  23. end;
  24. function TClass1.GetIntf2: IIntf2;stdcall;
  25. begin
  26. Result:=FIntf2;
  27. end;
  28. constructor TClass1.Create;
  29. begin
  30. inherited Create;
  31. FIntf2:=TClass2.Create;
  32. end;
  33. begin
  34. end.