I wanted to know if it is possible to use nested classes inside ROOT. i.e. I have a class that inherits from TObject. Inside this class I have one nested class with few double variables.
When I try to save the object in ROOT file and read it again I dont get correct values for the nested class data members. Where as doing the same without the nested class works well.
I wanted to know if ROOT supports nested classes and if someone can point to some code sample etc demonstrating the use of these classes etc. Specially I am clueless at the usage of ClassDef and ClassImp macros for the nested classes i.e. do I have to do it for the nested class or the ones for the eclosing classes are fine.
I looked at the pages that you mentioned. I am still unclear about one thing i.e. where do I put my ClassImp macro call in case of nested classes. Assuming that the classes are completely described in the surrounding class.
Hi,
the ClassImp macro is not needed anymore. Right now, THtml is the only thing that depends on it (i.e. you won’t get documented methods nor sources for classes without ClassImp); this will go away with the next version of THtml. So if I were you I’d just not use ClassImp for nested classes. If you do want to use it, just put it into your Outer.cxx, next to the ClassImp(Outer). If I remember correctly you’ll have to use ClassImp(Outer::Inner).
Axel.