[fpc-pascal] how to determine if a class has descendant registered within the current program

Dennis dec12 at avidsoft.com.hk
Wed Mar 8 11:47:07 CET 2017


I have a many classes, one inherits from another one, in an ancestor 
method, I want to test whether the calling class is a childless class.

e.g.
class function TAncestor.GetCaption : String; //virtual
begin
     if HasChild then
       result := 'something'
   else
     result := 'something else';

end;


where HasChild is a boolean class function that tells me whether the 
current calling class has children defined or now.

Is that possible?

Dennis



More information about the fpc-pascal mailing list