private void replaceChild(N oldNode, N newNode) {
if (isRoot(oldNode))
setRoot(newNode);
else
oldNode.getParent().replaceChild(oldNode, newNode);
}
In the above code (from AbstractBinarySearchTree class), L5 calls the superclass's method replaceChild(). Is this correct? If this is correct, how does the Java compiler know it has to call the superclass's replaceChild() method and not recursively call this class's replaceChild() method?
Binary Search Trees: Section 4.1
In the above code (from AbstractBinarySearchTree class), L5 calls the superclass's method replaceChild(). Is this correct? If this is correct, how does the Java compiler know it has to call the superclass's replaceChild() method and not recursively call this class's replaceChild() method?