initializing ifstream

Hi, easy question (i think).
I have a header file with a private ifstream& field, say ifstream& str, and in the .cpp file in visual studio i have made a constructor. When i build the project it errors and says "must be initialized in constructor base/member initializer list", which is right as i have not initialized it but i dont know how to do this. I thought it would be as easy as Chars::str() or something. (where chars is the name of the class). Any help appreciated. Thanks.
Reference must be initialized. You should consider using pointer.
but how do i initialize the reference. Shouldnt it be just one line of code in the constructor
What's the point of using a reference to an ifstream object anyways?

-Albatross
Last edited on
Topic archived. No new replies allowed.