Simple example:
Code:
#include <iostream>
#include <map>
using namespace std;
class Base
{
public:
virtual void foo() const {cout << "Base::foo" << endl;}
};//Base
class Derived
{
public:
virtual void foo() const {cout << "Derived::foo" << endl;}
};//Derived
int main()
{
multimap<int, Base*> mm;
Base B1, B2;
Derived D1, D2;
mm.insert(make_pair(1, &B1));
mm.insert(make_pair(1, &B2));
mm.insert(make_pair(2, (Base*)&D1));
mm.insert(make_pair(2, (Base*)&D2));
multimap<int, Base*>::const_iterator it = mm.begin();
for (; it != mm.end(); ++it)
it->second->foo();
return 0;
}//main
You'll have to post all the code if you want help with the segfault.
gg