the openFile function looks like it is trying to call the constructor on the stream but it is already constructed. You need to call the open member function on the stream object at this point. You'll need to have some basic checking in some of these functions to check if it needs to be opened. You'll also want to close the file in the destructor. Also, the other member functions can access the object directly so you don't need to wrap every filestream operation with an additional member function unless you want users of myclass to call them.