I want to make a wrapper Filer class to work with fstream library.
Thus, I want to pass an instance of fstream class through constructor of my own Filer class, which led to this code:
Filer::Filer(fstream fileObject)
{
fileObject this->fileObj;
};
Though when I compile it, an error is thrown that :
1>Filer.cpp(10): error C2143: syntax error : missing ';' before 'this'
While when I do this:
Filer::Filer(fstream fileObject)
{
this->fileObj = fileObject;
};
It throws this errors which complains that fstream could not be assigned in such way;
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::fstream' (or there is no acceptable conversion)
How should I then make my constructor accept an object of type fstream?