Ok, heres some more code:
Code:
class InvItem; // linked list superclass
class InvHead; // head
class InvTail; // tail
// INVITEM
class InvItem
{
public:
InvItem();
virtual ~InvItem() { delete next; } // don't delete prev because prev calls the deconstructer while deconstructing itself
InvItem *getNext() { return next; }
InvItem *getPrev() { return prev; }
protected:
InvItem *next, *prev;
};
InvItem::InvItem():
prev(0),
next(0)
{}
// INVHEAD
class InvHead : public InvItem
{
public:
InvHead();
virtual ~InvHead() {} // InvItem deconstructor cleans up
private:
};
InvHead::InvHead()
{
next = new InvTail(this);
}
// INVTAIL
class InvTail : public InvItem
{
public:
InvTail(InvItem *);
virtual ~InvTail() {}
private:
};
InvTail::InvTail(InvItem *head)
{
prev = head;
}
That's the code for the head and tail with just their constructors + deconstructors included. I still get the error though, so I think that should be enough. (At this point this is most of the code anyways).