A member function declared with const after its parameter list, int open() const, promises not to change the object. The compiler holds it to that: inside it, the members are read-only.
This matters because objects are often passed as const T&. Through a const reference you can only call const member functions, so a getter without const cannot be used by any function that takes the object read-only, and the compiler reports an error at the call.
The rule: every member function that only reads is const; functions that change state are not. A const member function can return a const reference to a member, which lets callers read a large member, such as a vector, without copying it and without changing it.
Read-only functions are const, so they work through a const reference.