有这样一个结构体:
typedef struct MineField { BOOL isMine; //1 is mine,0 is not mine, -1 unknown. int nearByNum; // the number of this grid's around. MineField() { isMine = -1; nearByNum = 0; } } MINEFIELD, *LPMINEFIELD; int main(){
int count = 10; struct MINEFIELD* pMineField; pMineField = new strucy MINEFIELD[count]; }
请问大家我这样写有哪里不对呢?为什么我编译时说“no appropriate default constructor available!”呢?
|
typedef的语法使用问题,如下两个形式可选:
MINEFIELD* pMineField;
pMineField = new MINEFIELD[count];
struct MineField* s;
s= new MineField[10];
多谢!