2012-01-16 10 views
11

Documentationは、インターフェイス委任はWin32のみで使用可能であると述べています。現在、私はそれをテストすることはできません、ドキュメントのバグやインタフェースの委譲は64ビットコンパイラで廃止されていますか?Win64でのインターフェイス委任

答えて

9

これはドキュメントのバグです。 Win64の次のビープ音:

program Win64delegatedInterfaces; 

{$APPTYPE CONSOLE} 

uses 
    SysUtils; 

type 
    IIntf = interface 
    procedure Foo; 
    end; 

    TMyClass = class(TObject, IIntf) 
    FIntf: IIntf; 
    property Intf: IIntf read FIntf implements IIntf; 
    end; 

    TMyOtherClass = class(TInterfacedObject, IIntf) 
    procedure Foo; 
    end; 

var 
    MyClass: TMyClass; 
    Intf: IIntf; 

procedure TMyOtherClass.Foo; 
begin 
    Beep; 
end; 

begin 
    MyClass := TMyClass.Create; 
    MyClass.FIntf := TMyOtherClass.Create; 
    Intf := MyClass; 
    Intf.Foo; 
end.