#ifndef __ACCOUNT_ARRAY_H__

#define __ACCOUNT_ARRAY_H__

#include "Account.h"

typedef Account * ACCOUNT_PTR;

class BoundCheckPointPtrArray

{

private:

ACCOUNT_PTR * accArr;

int arrlen;

BoundCheckPointPtrArray(const BoundCheckPointPtrArray& arr) { }

BoundCheckPointPtrArray& operator=(const BoundCheckPointPtrArray& arr) { }

public:

BoundCheckPointPtrArray(int len=100);// len을기본으로 100개 먹임

ACCOUNT_PTR& operator[](int idx);

ACCOUNT_PTR operator[](int idx) const ;

int GetArrLen() const;

~BoundCheckPointPtrArray();

};

#endif // !__ACCOUNT_ARRAY_H__




BoundCheckPointPtrArray::BoundCheckPointPtrArray(int len):arrlen(len) //100개 만들고 

{

accArr = new ACCOUNT_PTR[len];

}

ACCOUNT_PTR& BoundCheckPointPtrArray::operator[](int idx) // 100개 초과되면 밑에 if문 출력

{

if (idx<0 || idx >=arrlen)

{

cout << "Array index out of bound exception" << endl;

exit(1);

}

return accArr[idx];

}

ACCOUNT_PTR BoundCheckPointPtrArray:: operator[](int idx) const

{

if (idx<0 || idx >= arrlen)

{

cout << "Array index out of bound exception" << endl;

exit(1);

}


return accArr[idx];

}

int BoundCheckPointPtrArray::GetArrLen() const

{

return arrlen;

}

BoundCheckPointPtrArray::~BoundCheckPointPtrArray()

{

delete[]accArr;

}


저기 기본으로 100개를 만들려고 하는데 디버깅중에 값이 둘다 0으로 뜸 왜이런거냐