bool A (PatientNode * node) {
PatientBSTNode* i = new PatientBSTNode();
Root = i;
Root->SetName(node->GetName());
Root->SetDisease(node->GetCough());
}
이게 PatientBST.cpp파일인데 Root라는 멤버변수가지고있는데 그게 PatientBST.h 파일에
PatientBSTNode * Root;
이렇게있음
그리고
class PatientBSTNode
{
private:
char * Name;
char Disease;
PatientBSTNode * pLeft;
PatientBSTNode * pRight;
public:
PatientBSTNode();
이게 PatientBSTNode.h파일 일부분임
간략화한건데
Root = i; 저부분부터 안됨 컴파일하면 정상인데 디버깅하면 오류뜨고 안됨
이유가뭐임?
저 코드 일부만으로는 대략 추측이지만.. this가 null이거나 쓰레기값일거 같다. 즉 초기화되지 않은 객체의 멤버함수 콜 때린거.. 디버깅 되는 환경이면 뭐 금방 해결할듯?
this가 널값이라는게 무슨뜻이야?? 초기화되지 않은 객체? 확실히 디버깅에서 this가 0xCDCDCDCD라던데 뭐라는지 모르겠어
175.223 말이 맞음 0xCDCDCDCD면 힙영역인데 동적할당이 제대로 안됐다는거니까 this를 다시 만져보셈 - dc App