Option for MakeClass to create virtual methods

Dear ROOT experts!

This is my first post, so bear with me.

Reading the MakeClass hints in the User’s Guide I came to the conclusion that it would be a good idea to use MakeClass generated code as a basis for own classes, which then contain the user’s code. This would enable the automatic reconstruction of the class for the tree while the user’s code can basically stay the same. However, for this to work some methods of the generated class should be marked “virtual”. For my current problem I would need a virtual Notify(), but this equally applies in principle to Cut(), Init(), Loop() and Show(). Adding this feature to MakeClass as an option (similar to “selector”) would be quite easy, so I would happily do it, unless you explain to me why this would be a bad idea :wink:

Ciao,

Roland

Hi Roland,

I do no see any problem with making those function virtual in the generated MakeClass. You are welcome to provide such a patch.

Thanks,
Philippe.

Hi folks!

So, here’s the patch, which was quite obvious after reading the README.SELECTOR which comes with ROOT v4.00.08.

Ciao,

Roland
root_virtual.patch.txt (3.34 KB)

Unfortunately you did not start from the CVS version where many changes had already been done.
The functions are now declared virtual for the code generated by MakeClass.
Note that we recommend to use MakeSelector instead of MakeClass.
In this case the code generated is already OK for derivation because all the necessary functions are declared virtual in the base class TSelector.

Rene

Hi Rene!

Thanks for the information. I must have got the wrong impression, that the README.SELECTOR was some kind of “forward documentation” :wink: So I assume that my patch is already obsolete.

Ciao,

Roland