有没有办法在Delphi 7中获取旧样式(Borland Pascal)对象实例的类名?

我班上有很多后代:
PMyAncestor =^TMyAncestor;
TMyAncestor = object
  public
    constructor init;
    destructor done; virtual;
    // There are virtual methods as well
end;

PMyDescendant1 =^TMyDescendant1;
TMyDescendant1 = object ( TMyAncestor )
end;

PMyDescendant2 =^TMyDescendant2;
TMyDescendant2 = object ( TMyAncestor )
end;

PMyDescendant3 =^TMyDescendant3;
TMyDescendant3 = object ( TMyDescendant2 )
end;

procedure foo;
var
  pMA1,pMA2,pMA3,pMA4 : PMyAncestor;
  s : string;
begin
  pMA1 := new( PMyAncestor,init );
  pMA2 := new( PMyDescendant1,init );
  pMA3 := new( PMyDescendant2,init );
  pMA4 := new( PMyDescendant3,init );
  try
    s := some_magic( pMA1 ); // s := "TMyAncestor"
    s := some_magic( pMA2 ); // s := "TMyDescendant1"
    s := some_magic( pMA3 ); // s := "TMyDescendant2"
    s := some_magic( pMA4 ); // s := "TMyDescendant3"
  finally
    dispose( pMA4,done );
    dispose( pMA3,done );
    dispose( pMA2,done );
    dispose( pMA1,done );
  end;
end;

有没有办法获取其后代实例的类名?我不想因为这个原因创建一个方法(有成千上万的后代).
我知道有typeOf(T)运算符.但它的返回类型是什么?好.指针.但是我能把它投射出去?对PTypeInfo的强制转换似乎是错误的.

解决方法

当我编译此代码并在编译的可执行文件搜索类的名称时,找不到它们.

由此我得出结论,你要做的事情是不可能的.

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...