title: Inheritance Issue - Expected class-name before '{' token
body: <p>So I'm getting this error that has something to do with the way my AVLTree class is inheriting my BTree class. So far as I can tell, the compiler is acting as though it can't find BTree.h (which is in the same directory) or otherwise just doesn't like the way I'm including it. </p>
  
  <p>I've been looking around online, but most examples I see of this problem involve someone forgetting to include something, so I'm not sure what to do next.  </p>
  
  <p>Edit: I've also added the code sample for BTree.h</p>
  
  <p>Any assistance would be much appreciated.</p>
  
  <blockquote>
    <p>g++ -g -w -Wall TreeTest.cpp BTree.h BinaryTree.h AVLTree.h -o
    testTrees In file included from TreeTest.cpp:12:0: AVLTree.h:22:29:
    error: expected class-name before '{' token TreeTest.cpp: In function</p>
  </blockquote>
  
  <p>And here is the code: </p>
  
  <pre><code>#ifndef AVLTree_H
  #define AVLTree_H
  
  #include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include "BTree.h"
  
  using std::vector;
  using std::cout;
  using std::string;
  
  template &lt;class T&gt;
  class AVLTree : public BTree{
      public:
          struct TreeNode{
              TreeNode * leftChild, 
                   * rightChild;
              T key;
              vector&lt;T&gt; data;
              int size;
              int height;
              bool deleted;
          };
  
          //Standard tree functions
          AVLTree();
          virtual ~AVLTree();
          virtual bool isEmpty();
          virtual int getSize();
          virtual int getHeight();
          virtual int insert(T key, T data); //returns number of insert calls
          virtual int remove(T key);         //returns number of remove calls
          virtual int contains(T key);       //removes number of contains calls, or 0 if doesn't exist
          virtual std::vector&lt;T&gt; getData(T key);
  
          //Special functions
          virtual void displayAll();
          virtual double getAverageDepth(); 
          virtual int getTotalIPL();  //Retrieves internal path length from root
  
      private: 
          int size;
          TreeNode * root;
  
          int * contains(T key, TreeNode * node, int calls);
          int insert(T key, T data, TreeNode *&amp; node, int calls);
          int remove(T key, TreeNode *&amp; node, int calls);
          int getDepth(TreeNode*curr, int total);
          int getIPL(TreeNode * start, int level);
          void rotateLeft(TreeNode *&amp; node);
          void doubleLeft(TreeNode *&amp; node);
          void rotateRight(TreeNode *&amp; node);
          void doubleRight(TreeNode *&amp; node);
          int max(int a, int b);
          int getHeight( TreeNode * t );
          void display(TreeNode * node, string indent, bool last);
          TreeNode * makeNode(T key, T data);
          TreeNode * getNode(T key, TreeNode * node);
          void destroySubTree(TreeNode * start);
  };
  </code></pre>
  
  <p>And here is BTree.h: </p>
  
  <pre><code>#ifndef bTree_H
  #define bTree_H
  
  #include &lt;vector&gt;
  
  template &lt;class T&gt;
  class BTree{
      public:
          struct TreeNode{
              TreeNode * leftChild, 
                   * rightChild;
              T key;
              std::vector&lt;T&gt; data;
              int size;
          };
  
          //Standard tree functions
          virtual ~BTree();
          virtual bool isEmpty() = 0;
          virtual int getSize() = 0;
          virtual int getHeight() = 0;
          virtual int insert(T key, T data) = 0; //returns number of insert calls
          virtual int remove(T key) = 0;         //returns number of remove calls
          virtual int contains(T key) = 0;        
          virtual std::vector&lt;T&gt; getData(T key) = 0;
  
          //Special functions
          virtual void displayAll() = 0;
          virtual double getAverageDepth() = 0; 
          virtual int getTotalIPL() = 0;  //Retrieves internal path length from root
  
      private: 
          int size;
          TreeNode * root;
  
  };
  
  template &lt;class T&gt; 
  BTree&lt;T&gt;::~BTree&lt;T&gt;(){}
  
  #endif
  </code></pre>