You should be passing a reference to the stream objects:
class sudoku {
public:
void read(ifstream &ifs);
void write(ofstream &ofs);
private:
int puzzle[9][9];
};
void sudoku::read(ifstream &ifs){
// sudoku::read code here
}
void sudoku::write(ofstream &ofs){
// sudoku::write code here
}
This change is required because both ifstream
and ofstream
have a =delete
copy constructor. (Hat tip: @awesomeyi)