#include
using namespace std;
template
struct Binary_node
{
public:
Binary_node();
Binary_node(const Entry & x);
private:
Entry data;
Binary_node *left;
Binary_node *right;
};
template
class Binary_tree
{
public:
Binary_tree();
~Binary_tree();
void Layer_order(Binary_node & x);
Binary_node* getRoot();
protected:
Binary_node *root;
};
template
Binary_tree::Binary_tree()
{
}
template
Binary_tree::~Binary_tree()
{
}
template
void Binary_tree::Layer_order(Binary_node & x )
{
}
template
Binary_node* Binary_Tree::getRoot()
{
return root;
}
int main(void)
{
Binary_tree binarytree;
binarytree.Layer_order(*(binarytree.getRoot()));
return 0;
}
错误 2 error C2988: 不可识别的模板声明/定义 e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 6 error C2447: “{”: 缺少函数标题(是否是老式的形式表?) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 60 1 TEST_empty
错误 1 error C2143: 语法错误 : 缺少“;”(在“<”的前面) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 5 error C2143: 语法错误 : 缺少“;”(在“{”的前面) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 60 1 TEST_empty
错误 3 error C2059: 语法错误:“<” e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 4 error C2039: “getRoot”: 不是“`global namespace'”的成员 e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
模板没有识别,你的定义是不是有问题
后面缺少尖括号和模板参数列表
请你把代码完完全全的贴出来,
错误 2 error C2988: 不可识别的模板声明/定义 e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 6 error C2447: “{”: 缺少函数标题(是否是老式的形式表?) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 60 1 TEST_empty
错误 1 error C2143: 语法错误 : 缺少“;”(在“<”的前面) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 5 error C2143: 语法错误 : 缺少“;”(在“{”的前面) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 60 1 TEST_empty
错误 3 error C2059: 语法错误:“<” e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 4 error C2039: “getRoot”: 不是“`global namespace'”的成员 e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty