错误C2248:无法访问类中声明的私有成员

gui*_*cgs 4 c++

我在c ++应用程序中收到此错误:

error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' :
              cannot access private member declared in class '
Run Code Online (Sandbox Code Playgroud)

我在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;
}
Run Code Online (Sandbox Code Playgroud)

Mik*_*our 12

问题是:

string readLinee(ifstream batchFile);
Run Code Online (Sandbox Code Playgroud)

这会尝试按值传递流的副本; 但流不可复制.您希望通过引用传递:

string readLinee(ifstream & batchFile);
//                        ^
Run Code Online (Sandbox Code Playgroud)