I need to serialize a vector of pointers to base class and derived class. Serialize function overloaded for both classes, so I did it succesfully like this:`
CFile out;
if (!out.Open(filename.c_str(), CFile::modeWrite | CFile::modeCreate))
return false;
CArchive ar(&out, CArchive::store);
for (auto it = container_.begin(); it != container_.end(); ++it)
{
(*it)->Serialize(ar);
}
ar.Close();
out.Close();
So the question is, how should I DEserialize it now? I have no ideas about calling correct constructor while reading objects from CArchive...