Hi,
I am been testing the Object I/O functionality by loading a class from a script (using the ABC Class example taken from chapter 7 on “Adding a Class”, page 281-282, end of that chapter), as given below:
#include “TObject.h”
// define the ABC class and make it inherit from TObject so that we can write
// ABC to a ROOT file
class ABC : public TObject {
public:
Float_t a, b, c, p;
ABC() : a(0), b(0), c(0), p(0){};
// Define the class for the cint dictionary
ClassDef (ABC,1)
};
// Call the ClassImp macro to give the ABC class RTTI and full I/O capabilities.
#if !defined(CINT)
ClassImp(ABC);
#endif
I am using ROOT version 5.22 on a Linux box
Here are my specific questions:
Q1: Chapter 7 “Cint the C++ Interpreter”, bottom of page 90, says a Class defined in a cript can not inherit from TObject. Yet, the ABC class given above inherits from the TObject and can still be loaded using a script (.L ABCClass.C) and object I/O functionality seems to be full on. I was able to write and read an ABC object to and from a ROOT file in interpreted mode. Is this portion of the documentation in Chapter 7 outdated now, since TObject can now be inherited in script in interpreted mode?
Q2: I then deleted the ClassImp(ABC) macro, I did not provide “#pragma link c++ ABCClass” in the ABCClass.C script or in a link_def.h file, and yet, the ABCClass.C could still be compiled by ACLiC (.L ABCClass.C+).
Does it mean that the “#pragma link c++ ABCClass” and “ClassImp(ABC)” macro are not needed by ACLiC, and are only needed if I use rootcint to create a dictionary before compiling?
Thanks in advance.
Vi-Hoa