I have a problem
I wrote a class ResSearchTree that extends another class BinarySearchTree that resides within a package. Also in the package is a class called BinaryNode. I wrote an extension of this called ResNode. Then in ResSearchTree, I proceeded to override inherited methods to accept an instance of ResNode instead of BinaryNode.
example : ( Overridden insert method)
When I try to compile I get an error telling me that z.left and z.right can't be passed in the recursion because they are of type BinaryNode and
ResNode is required. Why doesn't this work if
ResNode extends BinaryNode? Also, why does the compiler recognize z.left and z.right as instances of BinaryNode and not ResNode
Here are the two node classes(BinaryNode and ResNode):
Any help would be greatly appreciated.
[ May 30, 2002: Message edited by: Dirk Schreckmann ]