Documentation指出,接口委派仅适用于Win32。目前我不能测试它,是文档错误还是接口委派在64位编译器中停止了?
发布于 2012-01-17 04:18:54
这是一个文档错误。以下是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.https://stackoverflow.com/questions/8885667
复制相似问题