Sorry if this is a question answered in the documentation, but I can’t find it.
I refer you to the sample code and output in the attached tarball. The code is based on an example from the tutorials. I define three classes: MyClass1, MyClass2, and MyClass3. They differ only in that MyClass1 does not derive from another class, MyClass2 derives from std::string, and MyClass3 derives from std::vector.
The code compiles and links with no errors (using Root 5.17/02). However (see file “myoutput” in the above archive):
If I start myroot and enter ‘MyClass1::’ followed by a tab, Root prints the public methods of MyClass1 as I would expect. Likewise MyClass2, including the methods inherited from std::string. But for MyClass3, only the methods of MyClass3 are printed, not the ones inherited from vector.
If I start myroot, enter ‘MyClass1 x1’ and similarly for MyClass2 and MyClass3, and then enter ‘x1.’ followed by a tab, Root prints the public methods of MyClass1 as I would expect. But for MyClass2 I get the message ‘problem determining class of “x2” / variable “x2.” not defined.’ However, ‘x2.c_str()’ works as expected. For MyClass3, “x3.” and tab causes only the methods of MyClass3 to be printed, not the ones inherited from vector, and ‘x3.resize(3)’ fails with the message ‘Error: Can’t call MyClass3::resize(3) in current scope (tmpfile):1:’. The Print method (not inherited) works for all three classes, however.
I assume these problems with MyClass2 and MyClass3 have to do with bad dictionaries for those classes, but how do I fix them?
myclasses.tar.gz (20.1 KB)