www.pudn.com > compressor.zip > BinTreeNode.h


#ifndef BinTreeNode_H 
#define BinTreeNode_H 
#include 
template   
class BinaryTree; 
template  
class BinTreeNode{ 
	friend class BinaryTree; 
	private: 
		BinTreeNode *leftChild,*rightChild; 
		T data; 
		int Flag; 
	public: 
		BinTreeNode():leftChild(NULL),rightChild(NULL),Flag(0){} 
		BinTreeNode(T item,int flag=0,BinTreeNode *left=NULL, 
			BinTreeNode *right=NULL):data(item),Flag(flag),leftChild(left),rightChild(right){} 
		T GetData() const {return data;} 
		int GetFlag() const {return Flag;} 
		BinTreeNode* Getleft() const {return leftChild;} 
		BinTreeNode* Getright() const {return rightChild;} 
		void SatData(const T& item) {data = item;} 
		void SatFlag(const T& item) {Flag = item;} 
		void SetLeft(BinTreeNode *L) {leftChild = L;} 
		void SetRight(BinTreeNode *R) {rightChild = R;} 
 
		int IsLeaf(){return this->rightChild==NULL 
			 &&this->leftChild==NULL&&this!=NULL?1:0;} 
}; 
#endif