わかりましたので、コードを最小限に単純化して、投稿する長いリストにならないようにしています..問題は、プログラムを終了するとコードがクラッシュすることです。つまり、デストラクタが呼び出されます。ポイントクラスはptlistクラスにあり、ボードクラスのptlistは、デストラクタでオブジェクトを削除するときに何らかの方法でリンクする必要があると考えていますが、if(item != NULL)行に到達した後にクラッシュしますptlistのデストラクタ関数...何らかの理由でif句もelse句も入力されません..理由がわからない..とにかく、私のプログラムのスリム化されたコードは次のとおりです。
[編集] 皆さんのおかげでコードを修正しました。今では完全に動作します。皆さん、ありがとうございました
#include <windows.h> //include all the basics
#include <tchar.h> //string and other mapping macros
#include <string>
#include <ctime>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
using namespace std;
class point
{
unsigned x;
unsigned y;
int id;
int type;
bool covered;
int maze;
public:
point(){x = 0; y = 0; id = 0; type = -1; covered = true; maze = 0;}
~point(){x = 0; y = 0; id = 0; type = 0; covered = true; maze = 0;}
};
class ptlist
{
point ** item;
int length;
int itemmax;
public:
ptlist(){item = NULL; length = 0; itemmax = 0;}
ptlist(int imax);
~ptlist();
};
ptlist::ptlist(int imax)
{
item = new point *[imax];
length = 0;
itemmax = imax;
}
ptlist::~ptlist()
{
delete [] item;
}
class board
{
ptlist *wall;
ptlist *path;
public:
board(){wall = new ptlist(1); path = new ptlist(1);}
~board(){delete wall; delete path;}
};