I'm trying to build a template file for a class that is the node for a doubly linked list. Whenever I try to compile, I run into this error.
ISO C++ forbids declatation of "DNode" with no type
It seems to crop up in response to my functions that return DNode pointers. I've been working on this for days, and can't seem to make heads or tails of it.
#ifndef DNODE_H
#define DNODE_H
#include <cstdlib>
#include <string>
#include <iostream>
#include <iterator>
template <class T>
class DNode
{
public:
DNode(T StartingData = T(), DNode* PrevLink = NULL, DNode* NextLink = NULL)
{Data = StartingData; previous = PrevLink; next = NextLink;}
void setData(T item)
{Data = item;}
void setNext(DNode *l)
{next = l;}
void setPrevious(DNode *l)
{previous = l;}
*DNode getPrevious() {return previous;}
*DNode getNext() {return next;}
T getData()
{return Data;}
private:
DNode *previous, *next;
T Data;
};
#endif