Hi,
I have a list of base types which stores multiple derived types. The following code shows a simplified setup.
#include "Base.h"
#include "DerivedA.h"
#include "DerivedB.h"
#include <iostream>
#include <list>
void main()
{
std::list<Base*> base;
std::list<Base*> *basePointer = &base;
for (int i = 0; i < 10; i++)
{
basePointer->push_back(new DerivedA);
basePointer->push_back(new DerivedB);
}
}
I iterate through this list using the iterator below:
std::list<Base*>::iterator baseItt = basePointer->begin();
baseItt++;
Is there a way I can find out which derived type 'baseItt' is pointing to? I need this to help me with saving and loading in my program.
Please let me know if this is not clear enough, and thanks in advance for any help you can provide.
Stemiros