title: Creating a n-ary tree
body: <p>I am trying to create a n-ary tree with a vector of the children. </p>
  
  <p>This is what I have gotten so far. </p>
  
  <p>In the node.h file I have this: </p>
  
  <pre><code>  #include &lt;vector&gt;
    #include &lt;string&gt;
  
    using namespace std;
  
    class Node{
  
    private:
        Node *parent; 
        vector &lt;Node*&gt; children; 
  
        int data; 
  
    public: 
        Node();
        Node(Node parent, vector&lt;Node&gt; children);
        Node(Node parent, vector&lt;Node&gt; children, int data);
  
        Node * GetParent(); 
  
        void SetChildren(vector&lt;Node&gt; children);
        vector&lt;Node&gt;* GetChildren();
        void AddChildren(Node children);
  
        void SetData(int data);
        int GetData();
  
        bool IsLeaf();
        bool IsInternalNode();
        bool IsRoot();
  
    };
  </code></pre>
  
  <p>And this is my node.cpp file. </p>
  
  <pre><code>   #include "node.h"
  
     Node::Node(){
         this-&gt;parent = NULL; 
         this-&gt;children = NULL; 
         this-&gt;data = 0;
     }
  
     Node::Node(Node parent, vector&lt;Node&gt; children){
         this-&gt;parent = &amp;parent; 
         this-&gt;children = &amp;children; 
     }
  
     Node::Node(Node parent, vector&lt;Node&gt; children, int data){
         this-&gt;parent = &amp;parent; 
         this-&gt;children = &amp;children; 
         this-&gt;data = data; 
     }
  
     Node* Node:: GetParent(){
         return this-&gt;parent;
     }
  
     void Node::SetChildren(vector&lt;Node&gt; children){
         this-&gt;children = &amp;children; 
     }
  
     vector&lt;Node&gt; * Node::GetChildren(){
         return this-&gt;children;
     }
  
     void Node::AddChildren(Node children){
         this-&gt;children.push_back(children);
     }
  
     void Node::SetData(int data){
         this-&gt;data = data;
     }
  </code></pre>
  
  <p>This obviously doesn't work. My main problem is that I am not quite sure how to handle the vector for the children. I wrote this following some tutorials online, but as you can see I am super confused. </p>