• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Method - Hiding (or Revealing?)

 
Shanel Jacob
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, Was looking at:

http://java.sun.com/docs/books/tutorial/java/javaOO/override.html

The example at the end shows subclass static method "hides" the superclass static method - It was the method in the superclass that gets called.

Am a little confused with the term "hide". My current interpretation seems that it is more like "revealing". As in, its the method in the superclass that is being used (revealed).
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here, static method in the superclass is hidden from the subclass, rather than the user/programmer. Static methods are also final by default. Hence, they cannot be overridden.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following similar but simpler code:


The term "hiding" is meant to be taken from the subclass AS1 point of view. Method AS1.m() in the subclass hides method AS.m() in the superclass.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic