Hi,

I'm trying to code a program that involves a double linked list. I have the linked list working but the information in the link list need to be shared between 2 different classes. Is it possible to pass a linked list as reference and manipulate it within the different classes?

i.e.

int main(void) {
    CList list;
    Class1 myObj1(list);
    Class2 myObj2(list);
    return 0;
}

class Class1 {
	public:
		Class1(CList* list) {
                    class1List = list;
                }
      protected:
           CList class1List;
};

class Class2 {
	public:
		Class2(CList* list) {
                    class1List = list;
                }
      protected:
           CList class2List;
};

I know this isnt 100% correct c++ but i just wanted to get the point of what I was trying to accomplish across. Is this or something like this possible? If not, what are my options?

Thanks!

Er, yes you can use functions and manipulate classes in a structure; just remeber to refer to them properly i.e. list->class1->function();