Hey i keep gettin syntax errors with my header file can someone please help me.

//******************************************************************************************
//Header file for LinkedList.cpp.
//******************************************************************************************
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
//******************************************************************************************
//Declaring templates for classes.
//******************************************************************************************
template<class Datatype> class LinkedListNode;
template<class Datatype> class LinkedList;
template<class Datatype> class LinkedListIterator;

//******************************************************************************************
//Class: LinkedListNode.
//Description: This is a class for the Linked List nodes.
//******************************************************************************************
template<class Datatype> 
class LinkedListNode
{
public:
//******************************************************************************************
//Member Variables.
//******************************************************************************************
    Datatype m_data;
    LinkedListNode<Datatype> * m_previous;
    LinkedListNode<Datatype>* m_next;

//******************************************************************************************
//Constructor
//******************************************************************************************
LinkedListNode()
{
    m_previous = 0;
    m_next = 0;
}
//******************************************************************************************
//Functions.
//******************************************************************************************
//******************************************************************************************    
//Function:insertAfter. Inserts a new node after the current node.
//******************************************************************************************
    void insertAfter(Datatype p_data)
    {
    //Create the new node.
    LinkedListNode<Datatype>* newNode = new LinkedListNode<Datatype>;
    newNode->m_data = p_data;
    //Make the new node point to the next node.
    newNode->m_next = m_next;
    //Make the previous node point to the new node.
    m_next = newNode;
    }
//******************************************************************************************
//Function:insertBefore. Inserts a node before the current node.
//******************************************************************************************
void insertBefore(Datatype p_data )
{
        //Create the new node.
        DListNode<Datatype>* newNode = new DListNode<Datatype>;
        newnode->m_data = p_data;

        //Set newnodes pointer.
        newnode->m_next     = this;
        newnode->m_previous = m_previous;

        //If there is a node before this make it point to the newNode.
        if( m_previous != 0 )
            m_previous->m_next = newNode;

        //Make the current node point to the newNode.
        m_previous = newNode;




};
//******************************************************************************************
//Class:LinkedList. This is the Doubly-linked list container.
//******************************************************************************************
template<class Datatype>
class LinkedList
{


//******************************************************************************************
//Class:LinkedList. This is the Doubly-linked list container.
//******************************************************************************************
template<class Datatype>
class LinkedListIterator
{
//******************************************************************************************
//Constructor.
//******************************************************************************************
    LinkedListIterator( LinkedList<Datatype>* p_list = 0, LinkedListNode<Datatype>* p_node = 0 )
    {
        m_list = p_list;
        m_node = p_node;
    }


}
}
};

#endif

Recommended Answers

All 2 Replies

What are the errors?

Member Avatar for majorawsome

is it that your missing a bracket after void insertBefore(Datatype p_data )?
line 55

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.