title: BinaryTree Node Class in C++
body: <p>I am trying to build a node class for binary tree implementation. Here is the header file for Node class:</p>
  
  <pre><code>class Node {
  public:
      Node();
      Node(int value);
      void setParent(Node&amp; parent);
      void setLeftChild(Node&amp; child);
      void setRightChild(Node&amp; child);
      void setValue(int value);
      void setIndex(int index);
      void setHeight(int height);
  private:
      int value;
      Node&amp; parent;
      Node&amp; leftChild;
      Node&amp; rightChild;
      int height;
      int index;
  };
  </code></pre>
  
  <p>Now, I want to write the constructor Node(int value) declared above.
  How shall I initialize the leftChild, rightChild, parent fields? They are also Node(s), so I want to call default constructor on them but it does not seem to work.
      Node::Node(int value) : value(value), parent(), leftChild(), rightChild(){
      }</p>
  
  <p>Compiler is saying that "reference to type 'Node' needs an initializer"</p>
  
  <p>Thanks.</p>