ClassDef variants


I have a problem with the documentation of the various ClassDef macros and when to use which of them. If I remember correctly there was such a documentation in previous times.

Could you help me to find the proper documentation about the ClassDef macros.

There is the Adding a class to ROOT page. Otherwise maybe @couet knows if there is some other document

This page I know but unfortunately it doesn’t explain the differences between the ClassDef variants.

So maybe @Axel can give some details

So we might need to update this page once we have the missing details.

ClassDef: Regular
ClassDefOverride: Use this one if your class definition use the c++ `override` keyword for virtual functions (If you use the regular ClassDef, the compiler might warn that the function declared in the ClassDef are missing the override keyword).
ClassDefNV: Use if you class does not (and shoud not) have a virtual function table (i.e. no virtual function in the class and any of its base classes

In addtion we also have


that can be use to create a class that is know to ROOT without generating a dictionary (this feature is still somewhat experimental),


…and luckily for us all, @eguiraud volunteered to provide a much needed, completely overhauled version of Adding a class to ROOT - ROOT !

With this said, often you don’t need ClassDef or inheritance from TObject at all, depending on what you want to achieve (e.g. just for reading/writing the class with ROOT, you don’t need them).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.