我们可以使用以下代码获取类方法地址:
type
TMyClass = class
procedure A;
end;
var P: Pointer;
begin
P := @TMyClass.A;
end;
对于一个通用类,如何从通用类中获取方法地址?
type
TGeneric<T> = class
procedure A;
end;
var P: Pointer;
begin
P := @TGeneric<T>.A; // <--- compilation error
end.