I have a fstream &
member in a class, on which I'm calling the seekg
function in a const function of the class, and yet the code compiles. I checked, and the seekg
is not declared const
(nor should it be), so how is this happening?
This is my code:
class Test {
fstream &f;
public:
Test(fstream &f_): f(f_) {}
int fid() const {
f.seekg(5);
return 0;
}
};