源代码如下:
TNode.h源代码:
class TNode
{
public:
bool visited;
short name;
TNode *parent,*child,*nextsibling;
TNode();
TNode(short name);
~TNode();
};
Tnode.cpp源代码如下:
#include "TNode.h"
TNode::TNode()
{
visited = false;
name = 0;
parent = NULL;
child = NULL;
nextsibling = NULL;
}
TNode::TNode(short name)
{
visited = false;
name = name;
parent = NULL;
child = NULL;
nextsibling = NULL;
}
TNode::~TNode ()
{
}
结果编译的时候报错 报的是:
d:\cpp\test\cube0227\tnode.cpp(6) : error C2065: 'NULL' : undeclared identifier
d:\cpp\test\cube0227\tnode.cpp(6) : error C2440: '=' : cannot convert from 'int' to 'class TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\cpp\test\cube0227\tnode.cpp(7) : error C2440: '=' : cannot convert from 'int' to 'class TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\cpp\test\cube0227\tnode.cpp(8) : error C2440: '=' : cannot convert from 'int' to 'class TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\cpp\test\cube0227\tnode.cpp(15) : error C2440: '=' : cannot convert from 'int' to 'class TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\cpp\test\cube0227\tnode.cpp(16) : error C2440: '=' : cannot convert from 'int' to 'class TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\cpp\test\cube0227\tnode.cpp(17) : error C2440: '=' : cannot convert from 'int' to 'class TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
就是说我的那个NULL好像是没定义 这个怎么处理呢 小弟初学C++请各位大侠指点 我的QQ:494135969 要是哪位想一块学的话可以交流一下