Nelviticus
Programmer
I've written a document printing application (Windows forms/C#) that has an ArrayList of DocumentGroup objects, each of which has an ArrayList of Document objects. I want the main application to be able to access each Document in each DocumentGroup. The way I have done this - and I think it's the wrong way - is to make the Documents ArrayList public in the DocumentGroup class. Is there a way to create an accessor so that I can expose it properly?
Apologies if that sounds confusing, I'm not very good at explaining things
The application creates a bunch of DocumentGroup objects, each of which creates a bunch of Document objects. I want the main app to have access to the properties & methods of each Document. The Documents are held in an ArrayList in each DocumentGroup, and rather than having a 'get' accessor I've just made the ArrayList public. As you're not really supposed to make a class's variables public I was wondering what the correct way of doing it was.
Regards
Nelviticus
Apologies if that sounds confusing, I'm not very good at explaining things
The application creates a bunch of DocumentGroup objects, each of which creates a bunch of Document objects. I want the main app to have access to the properties & methods of each Document. The Documents are held in an ArrayList in each DocumentGroup, and rather than having a 'get' accessor I've just made the ArrayList public. As you're not really supposed to make a class's variables public I was wondering what the correct way of doing it was.
Regards
Nelviticus