Hello, you may also want to explain what is the problem with having the default constructor setting fA to zero... Otherwise it is not quite clear what you're trying to fight - regards, pasha Alexander Yuryevich Zvyagin writes: > 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.
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:36 MET