template <class TYPE, class KTYPE>
class ExtAvlTree : public AvlTree<TYPE, KTYPE> {
public:
void ExtAvlTree_PrintDictionary();
void ExtAvlTree_ProcessNode (KTYPE key);
void ExtAvlTree_insertNewWord(string, int);
};
当我想用在AvlTree功能我不得不这样做:如果我不指定范围“AvlTree ::”我得到一个错误
template <class TYPE, class KTYPE>
void ExtAvlTree<TYPE, KTYPE>::ExtAvlTree_insertNewWord(string word, int data) {
TreeNode newWord;
newWord.key = word;
newWord.data = data;
AvlTree<TYPE, KTYPE>::AVL_Insert(newWord); //look here <--
}
:
error: there are no arguments to 'AVL_Insert' that depend on a template parameter, so a declaration of 'AVL_Insert' must be available [-fpermissive]|
从我的知识,当在派生类中使用基类的功能时,我不必指定范围。如果有关系,我正在使用codeblocks 16.01 IDE。
请发表[最小,完整,可验证的示例] (http://stackoverflow.com/help/mcve)。 –
请注意,有问题的代码使用**模板**,因此“使用来自基类**类的函数”的分析可能会引起误解。模板不是类;它们是创建类的**模式**,它们有一套使模板实例化合理的规则,而这些规则不适用于类。 –