This is a homework related question, but the compiler issue isn't the homework, I've already implemented the function I needed to write, just need to figure out this compiler error now.
I've tried searching and so far the results I get which come close to my question don't fit what causes my compiler error.
From binaryTree.h :
#include <iostream>
#include "orderedLinkedList.h"
using namespace std;
// Definition of the Class
template <class elemType>
class binaryTreeType
{
[rest of definition]
public:
[rest of declarations]
void createList(orderedLinkedList<elemType>& list);
[rest of declarations]
private:
void inorderToList(nodeType<elemType> *p, orderedLinkedList<elemType>& tList) const;
[.... then the definitions]
template <class elemType>
void bSearchTreeType<elemType>::createList(orderedLinkedList<elemType>& tList)
{
inorderToList(this->root, tList);
}
// copies to list
template <class elemType>
void bSearchTreeType<elemType>::inorderToList(nodeType<elemType> *p,
orderedLinkedList<elemType>& tList) const
{
if (p != NULL)
{
inorder(p->lLink);
tList.insert(p->info);
inorder(p->rLink);
}
}
I receive the errors :
binaryTree.h:250: error: expected initializer before ‘<’ token
binaryTree.h:257: error: expected initializer before ‘<’ token
The function definitions for createList() and inorderToList() are the ones are line 250 and 257 respectively. So I'm a little confused as to what I'm doing wrong here, and sure it's something simple.