some code should illustrate.
Expand|Select|Wrap|Line Numbers
- Feature::Feature(){
- cout<<"at b "<<oc<<endl;
- cout<<"b is "<<oc->geoSphere->getNumVs()<<endl;
- scoreData=ArrayTools::allocate2DArray<float>(oc->numSteps,oc->geoSphere->getNumVs());
- //some stuff
- }
- Feature::Feature(float weight,OVASControl* o) : weight(weight),oc(o) {
- cout<<"at a "<<oc<<endl;
- cout<<"a is "<<oc->geoSphere->getNumVs()<<endl;
- Feature();
- }
at a 0x1641bb0
a is 642 <-this is the correct value.
at b 0x7fadef8c0ded
Segmentation fault <-trying to access the pointer now segfaults.
since the flow goes from one constructor directly to the other, i dont understand how the class variable oc gets lost. Can anyone explain?
best regards,
Liam