Default constructor

Alexander Yuryevich Zvyagin (Alexander.Zviagine@cern.ch)
Thu, 13 Aug 1998 22:11:05 +0200 (METDST)


Hi, ROOTers!

I have one question about the role of default constructor for ROOT
objects.

In the class TMyClass I plan to use only one constructor:

class TMyClass : public TObject
{
public:
TMyClass(Int_t a);
void Work(void);
private:
Int_t fA;
ClassDef(TMyClass,1)
};

TMyClass::TMyClass(Int_t a)
{
// fA initialising ....
....
}

The function TMyClass::Work(void) will crash if fA is out of some legal
range. It seems that everything is fine: TMyClass::TMyClass(Int_t) sets
fA and TMyClass::Work(void) will work without problem. But in ROOT we must
have default constructor too. Will it be save to have empty default
constructor TMyClass::TMyClass(void){} ?

P.S. I know that it is possible to have the prototype TMyClass(Int_t a=0)
but it may help only for simple cases.

Thanks in advance,
Alexander Zvyagin.