gpt4 book ai didi

oop - 在运行时实现接口(interface)有什么好处?

转载 作者:行者123 更新时间:2023-12-03 14:58:40 26 4
gpt4 key购买 nike

我试图理解TVirtualInterface类。

{$APPTYPE CONSOLE}

uses
SysUtils, Rtti;

type
ISpecificInterface = interface(IInvokable)
['{281D8B97-397E-430A-895A-9CA4E1F5FB5F}']
procedure SpecificProcedure;
end;

procedure AProcedure(Method: TRttiMethod; const Args: TArray<TValue>;
out Result: TValue);
begin
Writeln(Method.ToString);
end;

var
ISpecificInterfaceInstance: ISpecificInterface;

begin
ISpecificInterfaceInstance := TVirtualInterface.Create
(TypeInfo(ISpecificInterface), AProcedure) as ISpecificInterface;

ISpecificInterfaceInstance.SpecificProcedure;

end. // TVirtualInterface ref. counter is decremented

在运行时实现接口(interface)有什么好处?

空间有什么用?

最佳答案

描述为here

Provides functionality for remote procedure call marshaling...

关于oop - 在运行时实现接口(interface)有什么好处?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36736561/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com