I do have two classes: a reader and a writer. For both classes I have an abstract interface since the data source/target should be flexible:
class abstract_reader {
...
};
class concrete_reader : public abstract_reader {
DATATYPE m_data;
...
};
class abstract_writer {
...
};
class concrete_writer : public abstract_writer {
DATATYPE m_data;
...
};
The writer shall have both functionalities, to read and to write The implementation of the reading part of the concrete_writer is the same as the implementation of the concrete_reader. What would be a good way to combine these classes?
What you want is a little confusing, but there is a number of ways:
Personally, I would follow the last way, then you will have a full set of classes for reading-only, writing-only, and for doing both.