2012-01-16 9 views
11

Documentation stwierdza, że ​​delegowanie interfejsu jest dostępne tylko dla Win32. Obecnie nie mogę go przetestować, czy jest to błąd dokumentacji lub delegacja interfejsu została przerwana w 64-bitowym kompilatorze?Delegowanie interfejsu na Win64

Odpowiedz

9

To błąd dokumentacji. Następujące sygnały pod 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. 
Powiązane problemy