getting a classes array

lurker lurker at lurker.com
Fri May 2 23:03:37 PDT 2008


the following chrashes what do i do wrong? how does one manipulate class A's mVector array?

thanks


class A {
private:
	int mVector[20] = 0;
public:
	int* Self() { 
	  return  mVector.ptr; 
	}
	bool StatusErrors() {
	  if((this.mVector[0] == 1) && (this.mVector[1] > 0))
		  return true;
	  return false; 
	}
	void Reset() {
		for(int i = 0; i < 20; i++)
		  mVector[i] = 0;
	}
}

class B {
private:
  A aa = new A;
public:
  bool test() {
    ....
    do some stuff
    int i = somefunction(aa.Self());
		if(aa.StatusErrors())
			return false;
		aa.Reset();                          <------ crashes here
    int i = somefunction1(aa.Self());
		if(aa.StatusErrors())
			return false;
	}
}




More information about the Digitalmars-d-learn mailing list