Vector of classes, each with POD inside them (correct me if i'm wrong but this is just int, char, string. No pointers etc involved), and inside those classes if I want to use inherited classes how are these saved?
By inventing a binary file format and implementing functionality that writes a representation of your objects to this format and functionality that creates your objects from a binary file in the format you invented. There is nothing magical about this. You have functions for writing bytes and functions for reading bytes. Think about how to use these functions to store and retrieve the state you need to be persistent.
Say you have a vector of pointers to instances of Foobar objects, where Foobar is an abstract base class from which a concrete Foo class a concrete Bar class inherit. Say each foo and each bar contains only an integer ID. You could define a file format like this:
[number, n, of Foobars in vector - 4 bytes]
[ type of first Foobar object, Foo or Bar -- 1 byte]
[ id of first Foobar object -- 4 bytes]
[ type of 2nd Foobar object-- 1 byte]
[ id of 2nd Foobar object -- 4 bytes]
[ type of nth Foobar object-- 1 byte]
[ id of nth Foobar object -- 4 bytes]
Edited by jwezorek, 17 June 2013 - 10:54 AM.