derived classes in maps
<p>i have two independent class hierarchies, starting at <code>BaseClass1</code>, <code>BaseClass2</code></p>

<p>this is what I want to do:</p>

<pre><code>struct BaseClass1 {
  virtual void obtain_map(std::map&lt;int,BaseClass2&gt; &amp;map) = 0;
}
</code></pre>

<p>Subclasses of <code>BaseClass1</code> override the <code>obtain_map</code>. But the problem is that those sublcasses should be able to use subclasses of <code>BaseClass2</code> in the <code>map</code> parameter. (So in this sense, subclasses of the two "independent" hierarchies are actually related, or rather can be if the subclass designers want)</p>

<p>How can I accomplish this, or am I forced to create my own <code>map</code> class from scratch?</p>
