let say, I want to make a c++that will allow me to read the content of a file that I will call file.txt
I will create:
1- ReadDocument.h (that contains my class)
2- ReadDocument.cpp (That will contain my functions)
3- UseDocument.cpp (That will contain my main function, and will allow me to access all the others)
I don't want to open the file, and copy the content in a list every time I access a function.
Where should I create my list that contains the words from the file i opened? and how does the list pass through all the files as a member variable?
You can pass a reference to an empty list to a function and have the function read the file and populate the list. You can then pass a reference to the list to another function and have the other function manipulate the list. When the functions return, the original list will have been modified by the called function.