我发现TVirtualMethodInterceptor.Create不支持具有重载虚方法的类.举些例子
type
TLog = class
public
constructor Create();
procedure SaveLog(str: string); overload; virtual;
procedure SaveLog(str: string; Args: array of const); overload; virtual;
end;
constructor TLog.Create(str: string);
begin
end;
procedure TLog.SaveLog(str: string);
begin
end;
procedure TLog.SaveLog(str: string; Args: array of const);
begin
end;
procedure MyTest();
var
ttt: TLog;
vmi: TVirtualMethodInterceptor;
begin
ttt:=TLog.Create();
try
vmi:=TVirtualMethodInterceptor.Create(ttt.ClassType);
try
//
finally
vmi.Free();
end;
finally
ttt.Free();
end;
end;
Run Code Online (Sandbox Code Playgroud)
执行TVirtualMethodInterceptor.Create()时,它将引发异常"可用于支持此操作的RTTI不足".有人可以帮帮我吗?