Hello,
I have an interface called Dictionary which has a method insert(). This interface is implemented by class BSTree, but I also have a class AVLTree which is a child class of BSTree. AVLTree redefines the insert() so it suits it's needs. Now if I type the following code:
Dictionary data=new AVLTree();
data.insert();
there is a problem, because the insert() method that is called is of BSTree instead of AVLTree. Why doesn't the polymorphism kick in here? What is the appropriate solution- one that retains the principle of polymorphism?
Thank you in advance.
Best regards, Daniel