2016-10-11 2 views
0

私のC++で '{' token 'の前に予期されるクラス名がエラーになりました。私は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 

答えて

4

avlTreeはあなたがそれのためにテンプレート引数を指定する必要があり、クラステンプレートです:

class wordSearch: public avlTree<something> 

あなたの意思によると、あなたが作るかもしれませんwordSearchクラステンプレート:

template <typename myType> 
class wordSearch: public avlTree<myType> 
関連する問題