Figuring out the class of an inheriting object
<p>I have a linked list of <code>Foo</code> objects.  Foo is a base class, which has several classes inherit from it.  Say, classes <code>A, B, and C</code>.</p>

<p>I am cycling through this linked list and calling a method <code>some_method</code>, which has 3 definitions; one for each child class:</p>

<pre><code>some_method(A a);
some_method(B b);
some_method(C c);
</code></pre>

<p>The linked list is generic, so it is of type <code>Foo</code>, as it has an assortment of A, B and C objects.  </p>

<p>When I'm cycling through the linked list at <code>current_element</code>, calling <code>some_method(current_element);</code>, how can I make it call the right method? The compiler complained until I wrote a some_method that took the generic <code>Foo</code>, and it only calls into that method.</p>
