我已經聲明瞭一個包含另一個類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