This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Menu

 
Hans
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Component class implements the MenuContainer interface,why Frame class continue to implement the MenuContainer interface.I think Frame extneds from Component class,it automatically have the property of MenuContainer.So the other subclasses of Compoent can add Menu in their container.True of False.Why?
Thank you.
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO the best answer (by maha anna)is here
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maha Anna's post gives an explanation for the specific case of menus, but can anybody give a more general explanation? I'll rephrase the question:
What is the point of implementing an interface in a subclass when a superclass has already implemented that interface?
I've seen this construct used in other places in the core library. For instance, <code>AbstractList</code> implements the <code>List</code> interface and so do <code>ArrayList</code> and <code>LinkedList</code>, both of which inherit from <code>AbstractList</code>. Here's another example from the Collections API - <code>AbstractMap</code> implements <code>Map</code> and so do <code>HashMap</code> and <code>WeakHashMap</code>.
In all 3 of these examples (counting the menu classes), the topmost implementor is <code>abstract</code> and the subclasses are not. Does this have something to do with it?
jply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic