麻烦各位兄弟帮忙看一上:类模板中static的有关问题

麻烦各位兄弟帮忙看一下:类模板中static的问题
#ifndef BINARYNODE_h
#define BINARYNODE_h

#include<iostream>
using namespace std;

template<class DataType>class BinaryTree;

template<class DataType>
class BinaryNode{
friend class BinaryTree<DataType>;//friendly statement.
public:
//Constructors.
BinaryNode(DataType item,BinaryNode<DataType>* L=NULL,BinaryNode<DataType>* R=NULL)
:data(item),left(L),right(R){}
//Destructor.
~BinaryNode(){}


void Pre()const;
void In()const;
void Post()const;

void PreOrder(){ID=0;Pre();}
void InOrder(){ID=0;In();}
void PostOrder(){ID=0;Post();}

unsigned int GetPreOrder(BinaryNode<DataType>* root);
unsigned int GetInOrder(BinaryNode<DataType>* root);
unsigned int GetPostOrder(BinaryNode<DataType>* root);

private:
BinaryNode<DataType>* left;
BinaryNode<DataType>* right;
DataType data;
static unsigned int ID;
static DataType A[20];//for the order number of Pre,In, and Post.
};
template<class DataType>
void BinaryNode<DataType>::Pre()const{
A[ID]=data;
ID++;
if(left!=NULL)
left->Pre();
if(right!=NULL)
right->Pre();
}

template<class DataType>
void BinaryNode<DataType>::In()const{
if(left!=NULL)
left->In();
A[ID]=data;
ID++;
if(right!=NULL)
right->In();
}

template<class DataType>
void BinaryNode<DataType>::Post()const{
if(left!=NULL)
left->Post();
if(right!=NULL)
right->Post();
A[ID]=data;
ID++;
}


template<class DataType>
unsigned int BinaryNode<DataType>::GetPreOrder(BinaryNode<DataType>* root){
unsigned int order=0;
root->PreOrder();
int i=0;
for(i=0;i<20;i++)
if(BinaryNode<DataType>::A[i]==this->data){
order=i;
break;
}
return order;
}

template<class DataType>
unsigned int BinaryNode<DataType>::GetInOrder(BinaryNode<DataType>* root){
unsigned int order=0;
root->InOrder();
int i=0;
for(i=0;i<20;i++)
if(BinaryNode<DataType>::A[i]==this->data){
order=i;
break;
}
return order;
}

template<class DataType>
unsigned int BinaryNode<DataType>::GetPostOrder(BinaryNode<DataType>* root){
unsigned int order=0;
root->PostOrder();
int i=0;
for(i=0;i<20;i++)
if(BinaryNode<DataType>::A[i]==this->data){
order=i;
break;
}
return order;
}

#endif

类设计的想法是想通过static的数组A和下表ID储存二叉树各遍历顺序的序列,进而求得各节点在各中遍历序列中的序号。
调用下面三个函数之一
unsigned int GetPreOrder(BinaryNode<DataType>* root);
unsigned int GetInOrder(BinaryNode<DataType>* root);
unsigned int GetPostOrder(BinaryNode<DataType>* root);
时报错:
--------------------Configuration: BinaryTree - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "private: static char * BinaryNode<char>::A" (?A@?$BinaryNode@D@@0PADA)
main.obj : error LNK2001: unresolved external symbol "private: static unsigned int BinaryNode<char>::ID" (?ID@?$BinaryNode@D@@0IA)
Debug/BinaryTree.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

BinaryTree.exe - 3 error(s), 0 warning(s)
个人怀疑是类模板和static结合使用时有一些比较trick的东西,望各位兄弟不吝指教。。。。

------解决方案--------------------
得在类外面写
C/C++ code
template <class DataType>
unsigned int BinaryNode<DataType>::ID = 0;