I want to implement an AVL Tree using templates in C++. The header file, C++ file and the main file are as below :
AVLTree.h
#include <iostream>
using namespace std;
namespace MYTree
{
    template <class T>
    class AVLTree
    {
        public:
            struct AVLNode
            {
                struct AVLNode *left;
                struct AVLNode *right;
                struct AVLNode *parent;
                int balanceFactor;
            };
            //Constructor
            AVLTree();
            //Variables
            AVLNode *root;
            //Methods
            AVLNode<T> *lookup(const T &key);
            AVLNode<T> *insert(const T &key);
            void remove(const T &key);
    };
}
AVLTree.cpp
#include "AVLTree.h"
#include <iostream>
using namespace std;
template <class T>
AVLTree<T>::AVLTree()
{
    cout <<"HI\n";
}
template <class T>
AVLNode<T>* AVLTree<T>::lookup(const T &key)
{
}
template <class T>
AVLNode<T>* AVLTree<T>::insert(const T &key)
{
}
template <class T>
void AVLTree<T>::remove(const T &key)
{
}
main.cpp
#include "AVLTree.h"
#include <iostream>
using namespace std;
int main()
{
    AVLTree<int> tree();
    return 0;
}
When I compile the main.cpp, I get the following errors :
In file included from main.cpp:1:
AVLTree.h:27: error: `MyTree::Node' is not a template
AVLTree.h:28: error: `MyTree::Node' is not a template
AVLTree.h:30: confused by earlier errors, bailing out
Edit :
main.cpp:9: error: `AVLTree' undeclared (first use this function)
main.cpp:9: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:9: error: expected primary-expression before "int"
main.cpp:9: error: expected `;' before "int"
I am using templates for the very first time. Can someone help me ?
 
     
     
     
    