【发布时间】:2012-02-11 17:28:30
【问题描述】:
Documentation 声明接口委托仅适用于 Win32。目前我无法测试它,是文档错误还是接口委托在 64 位编译器中已停止?
【问题讨论】:
标签: delphi interface delphi-xe2 delegation
Documentation 声明接口委托仅适用于 Win32。目前我无法测试它,是文档错误还是接口委托在 64 位编译器中已停止?
【问题讨论】:
标签: delphi interface delphi-xe2 delegation
这是一个文档错误。 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.
【讨论】: