Passing I/O functions to a class.

References have to be initialized in the constructor, as Chaul said, but it wasn't that bad.