I am trying to write the code for double linked list........it works fine for a single linked but not for double.
I have bolded the line that is the cause of the error but I am out of ideas about how to correct it. Plz guide me in this matter
#include<iostream.h>
#include<conio.h>
// Node Class
class Node
{
public:
void set(int);
int get();
void setNext(Node *);
Node *getNext();
void setPrev(Node *);
Node *getPrev();
private:
int object;
Node *nextNode;
Node *prevNode;
};
I didn't review the whole code though
considering that bold line, you should check whether currentNode->getNext() returns NULL. in that case you don't need to set the pevious.
Do you know that stl has already a double linked list?