0

别介意我是个白痴

我当前的节点类

class node
{
public:
    int xCoord;   // current position
    int yCoord;
    int gCost;     //Cost to travel to node
    int hCost;
    int parentX;  // parent coordinates
    int parentY;
    node* parentNode;

    node(int x, int y, int g , int h, int pX, int pY, node* parent) 
        {xCoord=x; yCoord = y; gCost = g; hCost = h; parentX = pX; parentY = pY;   parentNode = parent;}

    int getxCoord() const {return xCoord;}
    int getyCoord() const {return yCoord;}
    int getgCost() const {return gCost;}
    int getfCost() const {return hCost;}
    int getparentX() const {return parentX;}
    int getparentY() const {return parentY;}

我想创建一个这样的节点

node* startNode = new node(startX, startY, 0, 0, 0, 0, null)

但是它给了我一个标识符“null”是未定义的错误

4

1 回答 1

2

C++中没有null。在 C++11 中有NULL,有0并且有nullptr 。

于 2013-05-01T22:28:07.243 回答