With just the std library, and being a C++ noob, I am wondering the following:
- Serialization: What is the best way to serialize my class? I have a Date class and was thinking of using << to serialize it to something in the format of YYYYMMDD. I would deserialize it by one of the constructors taking that format for a Date and creating the same valued object.
- Encapsulation & Formatted Output: I've been reading about true encapsulation in classes (have read about it for years) and some suggest not exposing anything in terms of the innards so it won't be tightly coupled. So for example, if I do use << to serialize, how do I offer the ability to output the date to the user in various formats? If I didn't use << for serialization, how would allow different output formats of the date also? What is the normal best practice for that?
While EE will want inline answers, Any links or books recommendations (in addition) would also be appreciated.