[fpc-pascal]How to obtain runtime type of class object in debugger ?

Michael Van Canneyt michael.vancanneyt at wisa.be
Tue Feb 25 14:07:26 CET 2003


On Tue, 25 Feb 2003, Olle Raab wrote:

> Is it possible ?
>
> In details:
>
> Suppose:
>
> program Test;
>
> type
>   TClassA = class;
>   TClassB = class(TClassA);
>   TClassC = class(TClassA);
>
>
>   procedure P( x: TClassA);
>
>   begin
>     ...
>   end;
>
> begin
>   P(TClassB.Create)
> end.
>
>
>
> If I watch x inside P in the IDE, i see it is of type TClassA.
>
> But I want to know it's runtime type, that is if it is TClassB or TClassC.

Check the function
  x.classname

It returns the class name.

Michael.




More information about the fpc-pascal mailing list