I´m getting this error in a c++ application:
error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' :
cannot access private member declared in class '
I have seen similar questions in stackoverflow, but I couldn't figure out what's wrong with my code. Can someone help me?
//header file
class batchformat {
public:
batchformat();
~batchformat();
std::vector<long> cases;
void readBatchformat();
private:
string readLinee(ifstream batchFile);
void clear();
};
//cpp file
void batchformat::readBatchformat()
{
ifstream batchFile;
//CODE HERE
line = batchformat::readLinee(batchFile);
}
string batchformat::readLinee(ifstream batchFile)
{
string thisLine;
//CODE HERE
return thisLine;
}
The problem is:
string readLinee(ifstream batchFile);
This tries to pass a copy of the stream by value; but streams are not copyable. You want to pass by reference instead:
string readLinee(ifstream & batchFile);
// ^
string batchformat::readLinee(ifstream batchFile)
is trying to copy the ifstream Take it by ref instead
string batchformat::readLinee(ifstream& batchFile)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With