title: I am making an AVL tree program and I am getting errors with my left and right variables
body: <p>I pulled this code from a previous program of mine where I was using AVL Trees without using a struct. I think the problem is how I am using the struct when using getLeft() and getRight().</p>
  <pre><code>#ifndef BINARYTREE_H
  #define BINARYTREE_H
  
  #include &lt;iostream&gt;
  using namespace std;
  
  
  class BinaryTree
  {
  private:
      struct TreeNode
      {
          string name;
          int krabbyPatty;
          TreeNode* left;
          TreeNode* right;
      };
      
      TreeNode* root;
      
      // Private member functions
      void insert(TreeNode *&amp;, TreeNode *&amp;);
      void destroySubTree(TreeNode *);
      //void deleteNode(string n, TreeNode *&amp;);
      //void makeDeletion(TreeNode *&amp;);
      void displayInOrder(TreeNode *) const;
      void display(TreeNode *ptr, int level);
      void getTotal(TreeNode *nodePtr, int &amp;total);
      void getMost(TreeNode *nodePtr, string&amp; n, int&amp; mostPatties);
      void getLeast(TreeNode *nodePtr, string&amp; n, int&amp; leastPatties);
  </code></pre>
  <p>I am getting errors right here saying expression must be a modifiable lvalue for left and right.</p>
  <pre><code>public:
      // Constructor
      BinaryTree()
      { 
  
          root = NULL; 
          left = NULL;
          right = NULL;
      }
  
      // Destructor
      ~BinaryTree()
      { 
          destroySubTree(root); 
      }
  
      // Binary tree operations
      void insertNode(string, int);
      int searchNode(string);
      //void remove(string);
  
      void displayInOrder() const
      {  
          displayInOrder(root); 
      }
      
      void getLeastNumPatties(string&amp;, int&amp;);
      void getMostNumPatties(string&amp;, int&amp;);
      int getTotalNumPatties();
      void displayTree();
  </code></pre>
  <p>The other errors are right here, I assume I am handling the struct wrong.</p>
  <pre><code>    TreeNode* getLeft()
      {
          return left;
      }
      TreeNode* getRight()
      {
          return right;
      }
      void setLeft(TreeNode* nodePtr)
      {
          left = nodePtr;
      }
      void setRight(TreeNode* nodePtr)
      {
          right = nodePtr;
      }
  
  };
  
  #endif
  </code></pre>