Hello, I've got a little pb. with one of my classes. It's a Vector class. Under root, I try : root[1] RBVector v root[2] v.ls() root[3] (0,0,0) -> this is OK. (default ctor) root[4] RBVector v1(3) -> ctor with size *** Break *** segmentation violation ---- Here's a piece of code : //_____________________________________________________________________________ RBVector::RBVector(void) : TObject() { // Default constructor of a RBVector : dim = 3 ; all components = 0 Int_t i ; pi = acos(-1.0) ; fSize = 3 ; fVector = new Float_t[3] ; if ( fVector == NULL ) { cout << "<E> fVector is NULL in RBVector::RBVector(void) - RBVector.CXX" << endl << flush ; exit(1) ; } for ( i = 0 ; i < fSize ; i++ ) fVector[i] = 0.0 ; } // end of RBVector::RBVector(void) //____________________________________________________________________________ RBVector::RBVector(const Int_t& n) : TObject() { // Default constructor of a RBVector of dim n : all components = 0 Int_t i ; pi = acos(-1.0) ; fSize = n ; fVector = new Float_t[fSize] ; if ( !fVector ) { cout << "<E> fVector is NULL in RBVector::RBVector(Int_t) - RBVector.C" << endl << flush ; exit(1) ; } for ( i = 0 ; i < fSize ; i++ ) fVector[i] = 0 ; } // end of RBVector::RBVector(Int_t) //____________________________________________________________________________ void RBVector::Copy(TObject& obj) { // copy this to obj Int_t i ; TObject::Copy(obj) ; ((RBVector&)obj).fSize = fSize ; if ( ((RBVector&)obj).fVector ) delete[] ((RBVector&)obj).fVector ; ((RBVector&)obj).fVector = new Float_t[fSize] ; for (i=0;i<fSize;i++) ((RBVector&)obj).fVector[i] = fVector[i] ; } --- Am I doing a big error, or is there a problem with CINT ? (first choice I guess...) Thanks for your help. -- APHECETCHE Laurent (mailto:aphecetche@ganil.fr) GANIL, B.P. 5027, 14076, Caen Cedex 5, France Vox: +33 (0)2 31 45 45 85 - Fax: +33 (0)2 31 45 46 65 WWW: http://ganp03.in2p3.fr/nof/ & (perso.) http://www.mygale.org/~p0mp0n
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET