Generic Tree Node Class meant for subclassing
<p>Background: I'm going to be using this code to implement my gui subsystem in OpenGl as the tree to which i plan on recursively rendering the current node and then the children according to its Z-axis index(depth).</p>

<p>I'm basically looking for constructive criticism... cases where this implementation is bad or might fail altogether</p>

<pre><code>    #include &lt;deque&gt;


    namespace Sandbox {
        class Node {
        public:
            Node();
            Node( Node* parent );
            ~Node();

            Node* GetFirstChild();
            Node* GetChild( int index );
            Node* GetLastChild();

            void AppendChild( Node* child );
            void AddChild( Node* child ,int index );
            void RemoveChild( int index );

            int  GetIndex() { return *_index; }
            void SetIndex( unsigned int &amp;index ) { _index = &amp;index; };
    protected:
        private:
    Node* _parent;
            int _index;
            std::deque&lt;Node*&gt;* _children;
        };
    }

    #endif // HEADER_GUARD__TREE


    Node::Node(): _parent(NULL), _index(NULL), _children(NULL){
        _children = new std::deque&lt;Node*&gt;;
        _index = new int;
        _index = 0;
    }
    Node::Node( Node* parent ): _parent(parent), _index(NULL), _children(NULL){
        _children = new std::deque&lt;Node*&gt;;
        _index = new int;
        _index = 0;
        _parent-&gt;AppendChild( this );
    }
    Node* Node::GetFirstChild(){
        return _children-&gt;front();
    }
    Node* Node::GetChild( int index ){
        return _children-&gt;at(index);
    }
    Node* Node::GetLastChild() {
        return ( _children-&gt;back() );
    }

    void Node::AppendChild( Node* child ) {
        _children-&gt;push_back( child );
        unsigned int index = _children-&gt;size();
        child-&gt;SetIndex( index );
    }
    void Node::AddChild( Node* child ,int index ) {
        std::deque&lt;Node*&gt;::iterator i = _children-&gt;begin();
        i = i + index;
        _children-&gt;insert( i, child );
        child-&gt;SetIndex( index );
    }
    void Node::RemoveChild( int index ) {
        std::deque&lt;Node*&gt;::iterator i = _children-&gt;begin();
        i = i + index;
        _children-&gt;at(index)-&gt;~Node();
        _children-&gt;erase( i );
    }
    Node::~Node() {
        /* From first child to last child */
        for(int i = 0; i &gt;= _children.size(); i++ ) { 
            _children-&gt;at(i)-&gt;~Node();                
    }
    _parent = NULL;
    _index = 0;
    _children-&gt;clear();
    delete _children;
}
</code></pre>
