I have decided to make a small collection of functions to work with doubly linked lists in OOP style.
My first idea which I still have for now is to make one class, which would be a linked list itself and another class, which would be the items in that linked list.
To make it more clear, here is some code:
class DLItem {
private:
int data;
DLItem *prev, *next;
public:
friend class DoublyLinkedList;
};
class DoublyLinkedList {
private:
DLObject *head, *tail, *curr;
public:
DLList(); //constructor
// FUNCTIONS HERE
};
Note that the code above is just a draft and might change dramatically and I just wrote it to make you my idea a little more clear.
What I want to ask for is how to realize my idea so that one class would be a template of a linked list itself and another - of an item in that list.
If you think that's ineffective, feel free to tell me and I accept any offers.
This post has been edited by kapax: 06 September 2008 - 01:41 PM

New Topic/Question
Reply




MultiQuote




|