[求助]帮我看看这段代码哪里错了?
这是一个huaffman tree我用模板老出这种问题
--------------------Configuration: MinHeap - Win32 Debug--------------------
Compiling...
main.cpp
h:\minheapand huaffman\huaffmantree.h(54) : error C2530: 'firstchild' : references must be initialized
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(54) : error C2530: 'secondchild' : references must be initialized
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(56) : error C2146: syntax error : missing ',' before identifier 'hp'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(56) : error C2065: 'hp' : undeclared identifier
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(56) : error C2143: syntax error : missing '>' before ';'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(63) : error C2248: 'dataprt' : cannot access private member declared in class 'HuaffmanCodeNode<char>'
h:\minheapand huaffman\huaffmantree.h(21) : see declaration of 'dataprt'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(64) : error C2248: 'data' : cannot access private member declared in class 'HuaffmanTreeNode<char>'
h:\minheapand huaffman\huaffmantree.h(10) : see declaration of 'data'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(65) : error C2248: 'parent' : cannot access private member declared in class 'HuaffmanTreeNode<char>'
h:\minheapand huaffman\huaffmantree.h(11) : see declaration of 'parent'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(65) : error C2248: 'leftChild' : cannot access private member declared in class 'HuaffmanTreeNode<char>'
h:\minheapand huaffman\huaffmantree.h(11) : see declaration of 'leftChild'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(65) : error C2248: 'rightChild' : cannot access private member declared in class 'HuaffmanTreeNode<char>'
h:\minheapand huaffman\huaffmantree.h(11) : see declaration of 'rightChild'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(67) : error C2228: left of '.MinHeap' must have class/struct/union type
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(68) : error C2374: 'i' : redefinition; multiple initialization
h:\minheapand huaffman\huaffmantree.h(61) : see declaration of 'i'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(71) : error C2065: 'firstChild' : undeclared identifier
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(71) : error C2228: left of '.DeleteTop' must have class/struct/union type
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(72) : error C2065: 'secondChild' : undeclared identifier
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(72) : error C2228: left of '.DeleteTop' must have class/struct/union type
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(74) : error C2228: left of '.Insert' must have class/struct/union type
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function '__thiscall HuaffmanTree<char>::HuaffmanTree<char>(char [],int)'
h:\minheapand huaffman\huaffmantree.h(110) : error C2248: 'bit' : cannot access private member declared in class 'HuaffmanCodeNode<char>'
h:\minheapand huaffman\huaffmantree.h(19) : see declaration of 'bit'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function 'void __thiscall HuaffmanTree<char>::display(void)'
h:\minheapand huaffman\huaffmantree.h(111) : error C2143: syntax error : missing ';' before '}'
h:\minheapand huaffman\main.cpp(13) : while compiling class-template member function 'void __thiscall HuaffmanTree<char>::display(void)'
执行 cl.exe 时出错.
main.obj - 1 error(s), 0 warning(s)