Original Post
Hi, Say you have a class A which has children B, C, D, E, F, etc... You have a whole list of A*'s that can be of any of the child-types, and want to write the list to XML. You implement class A butthe children are implemented by someone else elsewhere so you can't know what they'll be and how they'll need to be written to XML. The above is easily done: so you make it go through the list of A*'s, and call avirtual XML-writing function so that the B, C, D, etc... will write themselves correctly (with a parameter for the pretty indentation in XML and such but that doesn't matter here). So it's really nice that you can save that way from one central point to XML tags for any type of object that you don't have to know about. But: how could it be implemented to read it again? Of course what's written also needs to be read. From your central point you only know about A, but if you encounter a tag for B, C, D, ... you'll have to construct one of the correct type which you can't. How can the reading of the above structure be done from a central point but without you having to know about the child-types, but somehow the child-types themselves creating themselves in your list? In C++ btw.