Polymorphism not working correctly
<p>I have an interface called Dictionary which has a method <code>insert()</code>. This interface is implemented by class <code>BSTree</code>, but I also have a class <code>AVLTree</code> which is a child class of <code>BSTree</code>. <code>AVLTree</code> redefines the <code>insert()</code> so it suits it's needs. Now if I type the following code:</p>

<pre><code>Dictionary data=new AVLTree();
data.insert();
</code></pre>

<p>There is a problem, because the <code>insert()</code> method that is called is of <code>BSTree</code> instead of <code>AVLTree</code>. Why doesn't the polymorphism kick in here? What is the appropriate solution, one that retains the principle of polymorphism?</p>
