Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: Beginner
Aug 3, 1999



Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

Persistence and Serialization

What is the best source, print or online, for learning how to implement persistence in C++? I want to save my objects to disk and restore them, and I want to learn how to do this from scratch, not by purchasing someone's library.

I don't know which compiler you are using. If you are using Visual C++ and MFC, then you are pretty much be forced into using their model of object persistence. Al Stevens had a book, C++ Database Development, that covered this to some degree, but that's an older book. I don't know of any book that focuses just on this topic but I'm sure you could find a discussion in any good C++ book.

The basic concept is pretty straightforward: The object knows best what needs to be saved to disk. So you can write a Serialize method for your classes. Then, you can basically tell an object to save itself. Perhaps the hardest part is determining which object must be created and told to load itself when reading a file. For this, you need to also save information about that object to the file.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date