I am trying to pass: ifstream infile;
in my main (), to the constructor of a class called "FIFO": FIFO (infile);
In the header file of FIFO (FIFO.h), I have:
FIFO (std::ifstream);
std::ifstream infile;
And in FIFO.cc, I have:
FIFO::FIFO (std::ifstream & INFILE)
{
infile = INFILE;
}
I kept getting like (There are more of them, I just paste one of them):
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/localefwd.h:43, from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/string:45, from FIFO.cc:7: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/ios_base.h: In member function ‘std::basic_ios >& std::basic_ios >::operator=(const std::basic_ios >&)’: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/ios_base.h:793: error: ‘std::ios_base& std::ios_base::operator=(const std::ios_base&)’ is private /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iosfwd:47: error: within this context
I am not sure if passing ifstream using reference works or not, or it is my codes problem.
Thanks!