【发布时间】:2017-02-19 13:31:11
【问题描述】:
我在我的 C++ 中收到错误“在 '{' 标记之前的预期类名”。我正在尝试将 avlTree 类继承到单词搜索类中,但它不起作用。
#ifndef WORDSEAR_H
#define WORDSEAR_H
#include <string>
#include "avlTree.h"
class wordSearch: public avlTree
{ <----error right here
public:
//functions are here
private:
};
#endif
这是 avlTree.h
#ifndef AVLTREE_H
#define AVLTREE_H
template <class myType>
struct nodeType {
myType keyValue;
nodeType<myType> *left;
nodeType<myType> *right;
};
template <class myType>
class avlTree
{
public:
//functions are here
private:
};
#endif
【问题讨论】:
标签: c++ class templates inheritance header