#include
#include
#include
#include
#include
using namespace std;
template
class BinaryTree
{
};//这个类需要定义下,就可以了
template
class BinaryTreeNode
{
friend class BinaryTree
private:
T info;
BinaryTreeNode
public:
BinaryTreeNode()
{
info = 0; left = right = NULL;
};//空构造函数
BinaryTreeNode(T&ele)
{
info = ele; left = right = NULL;
};
T value()
{
return info;
};//返回当前节点数据
BinaryTreeNode
{
return left;
};//返回当前节点左子树
BinaryTreeNode
{
return right;
};//返回当前节点右子树
void setLeftchild(BinaryTreeNode
{
left = current->left;
};//设置当前节点左子树
void setRightchild(BinaryTreeNode
{
right = current->right;
};//设置当前节点右子树
void setValue(T& val)
{
val = info;
};//设置当前节点数据域
bool isLeaf()
{
if ((left == NULL) && (right == NUll))
{
cout << "当前节点为叶节点" << endl;
return true;
}
else
return false;
};//判断是否是叶节点
BinaryTreeNode
{
this = Node;
};//重载赋值
//~BinaryTreeNode(){};
};
int main()
{
}