[fpc-pascal] All methods vitrual ?

Michael Van Canneyt michael at freepascal.org
Tue Oct 10 08:41:27 CEST 2023



On Mon, 9 Oct 2023, Adriaan van Os via fpc-pascal wrote:

> Is there a trick to make (in mode macpas) all class methods implicitely 
> virtual ? I mean, without adding the virtual keyword to all of them ? The 
> reason is that I want to create a tree view of the class hierarchy with all 
> the method names (not just those that are normally in the VMT because they 
> are overridden).
>
> Any other ideas ?

If you need this tree at run-time:

- The "extended RTTI" branch of fpc allows you to list all methods,
   regardless of their visibility

- In the released compiler, if you remove all visibility specifiers, you can
   get a list by specifying {$M+} on your base object and then list all
   published methods using the RTTI.

If you simply need this tree:

- You can simply use fcl-passrc to analyse your source tree and create the complete
   list. No changes to code needed. I have several programs that do this.

Michael.


More information about the fpc-pascal mailing list