Considering the former question, 28969745
, I wanted to ask some new and further questions.
When making my classes for serialization, would I want to offer various means of serialization?
Example: I have a vb.net application that saves data from an employee class as lines in a CSV file.
The | char is used as a delimiter and it works fine for this application. I am trying to redo this application in C++.
In C++ if I did the same, allowing serialization with | between fields, it would be fine for the current application, but if later I wanted to reuse one of my C++ classes I could foresee not wanting that restriction and perhaps wanting to serialize via XML or binary or some other format.
I would like to know:
- Should I offer various mechanisms on each class for serialization
- or Does a class just spit out its members to the serialization object or method and let it worry about separation
- Could anyone provide a brief sample code of this completely in practice
I have gotten great answers on the former question, but not wanting to beat that one to death with the person answering, decided to ask further details as an additional question