好吧,我检查了丢失的分号,据我所知,我没有任何包含循环,所以我有点难过。我一直在查看发布的其他示例,但我仍然不太明白我缺少什么。我猜这与使用我没有正确处理的模板有关,但我真的不知道。
In file included from customtester.cpp:6:0:
MyBSTree.h:23:1: error: expected class-name before â{â token
文件:
#ifndef MYBSTREE_H
#define MYBSTREE_H
template <typename T> //not sure which of these I need,
class AbstractBSTree; //the include, the forward
#include "abstractbstree.h" //declaration, or both.
template <typename T>
class TreeNode
{
T m_data;
TreeNode<T> * m_right;
TreeNode<T> * m_left;
};
template <typename T>
class MyBSTree:public AbstractBSTree //this would be line 23
{
TreeNode<T> * m_root;
int m_size;
};
#endif
有什么我想念的吗?我无法修改“abstractbstree.h”