Hi On a related subject, what are the rules for initializing const members outside the class definitions? My C++ books don't cover that very well ;-) E.g. class myclass : public TObject { public: const Int_t count; ... } The following doesn't compile: myclass::myclass(Int_t newcount){ count=newcount; } I thought you got once chance to initialize a const, and that the constructor may be the place to do it, but this is obviously not the case :-) Cheers! Conrad On Fri, 2002-08-30 at 06:40, Jiri Masik wrote: > Mykulyak Andriy <A.Mykulyak@gsi.de> writes: > > > Hello, > > > > I wonder, why I cannot use consts as static class members. > > > > class TAFextPropHit : public TObject { > > public: > > static const Int_t kSignalCount = 8; > > static const Float_t kScaleFactor = 1.5; > > > > TAFextPropHit(); > > virtual ~TAFextPropHit(); > > ... > > > > ClassDef(TAFextPropHit, 1) > > ... > > }; > > > > The class above will compile, but the shareable library built out of it will > > not load into the ROOT runtime. > > > > Hi, > > I think the initialization of a static data member should happen > outside of the class definition > > class TAFextPropHit { > public: > static const Int_t kSignalCount; > }; > const Int_t TAFextPropHit::kSignalCount=8; > > What kind of error do you get? > cheers > Jiri > -- *-----------------------------------------* | Conrad Steenberg | | Caltech, Mail Code 356-48 | | Pasadena, CA, 91125 | | e-mail: conrad@hep.caltech.edu | | Tel: (626) 395-8758 | *-----------------------------------------*
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET