我已经声明了一个包含另一个类AVLNode的类AVL。 AVL类包含一个插入函数。我想插入返回一个AVLNode指针。我在这段代码中遇到了编译错误。什么是错误?根据模板参数返回值
template<class KeyType>
class AVL
{
public:
template<class KeyType>
class AVLNode{};
AVLNode<KeyType>* insert(const KeyType& key);
}
template<class KeyType>
AVLNode<KeyType>* AVL<KeyType>::insert(const KeyType& key)
{
if (m_root == 0)
{
m_root = new AVLNode<KeyType>(key);
return m_root;
}
else
return insert_Helper(key,m_root);
}
什么是编译错误? – hrkz