[fpc-pascal] How to know if a class implements a method

Joao Morais post at joaomorais.com.br
Fri May 18 15:24:22 CEST 2007


Any idea how I know if a class, in a class pointer, overrides a virtual 
method? Eg:

tfooclass = class of tfoo;

tfoo = class
   procedure sample; virtual;

tboo1 = class(tfoo)

tboo2 = class(tfoo)
   procedure sample; override;


vfooclass := tboo1;
// vfooclass doesn't implement sample.

vfooclass := tboo2;
// vfooclass implements sample.

At this moment I know that:

1. I could cast a method pointer with tmethod if sample was a class method;

2. I could cast this same method pointer if I had an instance of vfooclass.

But is there another way beyond creating an instance?


Joao Morais

More information about the fpc-pascal mailing list