You are correct in that Tree should extend the Dictionary class. There are several reasons, but the easiest to see is contained right in your topic subject: a tree
is a type of a dictionary. As you said,
the Dictionary can clearly do everything specified (with exact method signatures) and then Tree can do that and a whole lot more. It wouldn�t make sense to say a Tree "has a" Dictionary. If it did, how would you call the Dictionary methods from outside the tree? It could be done, but the resulting code would be convoluted. But more importantly, you wouldn't be rewriting similar or duplicate code in the Tree class that you already have in the Dictionary class; it all would be inherited.
Tied to this basic "is a" reason, is the second reason why it should extend Tree:
polymorphism. If Tree extends Dictionary, it can be used anywhere the Dictionary class is called for. So if you have a method in SomeClass with the following signature:
If Tree extends Dictionary, you can do this:
That�s a very powerful paradigm. Overall, it just makes much more sense for Tree to extend Dictionary then to have one as an instance variable.