one way is to have the base class declare an 'm_type' variable (an enum would be convenient) that the inheriting classes must define - which you then can ask for and based on the type make the correct cast.So when I serialize this list, how do I make sure it's actually ChildClass1 or ChildClass2 instances beeing serialized ?
Once the pointer is casted, the correct stream operator will be used automatically.
Bookmarks