tw11862a.pp 855 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. { %fail }
  2. program bug9;
  3. {$ifdef fpc}
  4. {$mode delphi}
  5. {$endif}
  6. type
  7. ITest = interface(IInterface)
  8. ['{FE6B16A6-A898-4B09-A46E-0AAC5E0A4E14}']
  9. function Parent: ITest;
  10. function GetChild: ITest;
  11. end;
  12. ITestEx = interface(ITest)
  13. ['{82449E91-76BE-4F4A-B873-1865042D5CAF}']
  14. end;
  15. TTest = class(TInterfacedObject, ITest)
  16. function ITest.Parent = ParentEx;
  17. { ITestEx }
  18. function ParentEx: ITestEx;
  19. function GetChild: ITest;
  20. procedure RemoveChild;
  21. end;
  22. { ITest }
  23. { ITestEx }
  24. function TTest.ParentEx: ITest;
  25. begin;
  26. Result := nil
  27. end;
  28. function TTest.GetChild: ITest;
  29. begin;
  30. WriteLn('TTest.GetChild');
  31. Result := nil
  32. end;
  33. procedure TTest.RemoveChild;
  34. begin;
  35. WriteLn('TTest.RemoveChild');
  36. end;
  37. var E: ITest;
  38. begin
  39. E := TTest.Create;
  40. WriteLn('Calling GetChild');
  41. E.GetChild();
  42. WriteLn('Stop');
  43. end.