我在C++应用程序中遇到此错误:
error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' :
cannot access private member declared in class '
我在stackoverflow中看到过类似的问题,但是我无法弄清楚我的代码出了什么问题。有人能帮我吗?
//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;
}
最佳答案
问题是:
string readLinee(ifstream batchFile);
尝试按值传递流的拷贝;但流不可复制。您想通过引用传递:
string readLinee(ifstream & batchFile);
// ^