A public default constructor is required to be implemented. It is used by the ROOT Object I/O system. A C++ default constructor takes no arguments. For example, in a class ToyMuon, its declaration looks like:
class ToyMuon
{
public:
ToyMuon(void) ; // "void" is optional for argument list declarations
}
It is considered good class design to provide a copy constructor and an assignment operator for all classes, if such makes sense for the class in question. Note that C++ compilers will attempt to generate such methods automatically (which you may choose to take advantage of). So, if you cannot define sensible implementations, be sure to declare them private to avoid compiler-generated implementations. Their public declaration for a class ToyMuon looks like:
class ToyMuon
{
public:
ToyMuon(const ToyMuon& muon) ;
ToyMuon& operator=(const ToyMuon& muon) ;
}
The CDF Run II EDM further requires that StorableObjects (not StreamableObjects) have a public clone() method which returns a newly allocated copy of the object. At present, clone() is only used with the Begin-of-Run event record in order to make a copy of it. Some complicated classes which never appear in Begin-of-Run records have chosen to provide dummy clone(), copy constructors, and assignment operators. The clone method declaration and implemetation for a class ToyMuon might look like this:
class ToyMuon
{
public:
ToyMuon* clone(void) // inline implemention for doc brevity
{ return new ToyMuon(*this) ; // create copy, return pointer to copy
}
}
Comments on this page may be sent to Rob Kennedy