I am getting a syntax error when I try to compile. After I write a little code I try to compile to catch any of my mistakes.
In this project I am to use a class queue template that is provided by my instructor here it is
#ifndef TEMPLATEQ_H
#define TEMPLATEQ_H
#include <iostream>
#include <new>
#include <cstddef>
using namespace std;
class FullTemplateQ // Exception class
{};
class EmptyTemplateQ // Exception class
{};
template<class SomeType> // Node template class
struct QueueNode
{
SomeType data; // Data stored in queue node
QueueNode<SomeType>* nextPtr; // Pointer to next queue node
};
template<class SomeType> // Circular queue template class
class TemplateQ
{
private:
QueueNode<SomeType>* rearPtr; // Pointer to rear of queue
QueueNode<SomeType>* frontPtr; // Pointer to front of queue
void PrintNext(QueueNode<SomeType>* tempPtr) const; // Print trailing items
public:
TemplateQ(); // Default constructor
~TemplateQ(); // Destructor deallocates every node
void Enqueue(SomeType newData); // Adds newdata node to rear of queue
SomeType Dequeue(); // Removes data node from front of queue,
// returning the stored data
bool IsFull() const; // Returns true if queue is full,
// false otherwise
bool IsEmpty() const; // Returns true if queue is empty,
// false otherwise
int Size() const; // Returns the number of items in queue
void ForwardPrint() const; // Prints queue, front to rear
void ReversePrint() const; // Prints queue, rear to front
};
#include "templateq.cpp" // Very Important!! Do not delete!!
#endif
here is what I have so far
#include <new>
#include <cstddef>
using namespace std;
template <class someType>
TemplateQ<someType>::TemplateQ()
{
rearPtr = NULL;
frontPtr = NULL;
}
When I try to compile this little bit of code I get this syntax error.
8 expected constructor, destructor, or type conversion before '<' token
8 expected `;' before '<'
What am I missing?