• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sybex Flash Card Set#2 #48 Errata?  RSS feed

 
Charles O'Leary
Ranch Hand
Posts: 185
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the definition of Hidden from Sybex Flash Card Set#2 #48 correct?


Definition
Overloaded methods share the same name but different signatures and have no polymorphic relationship. Overridden methods share the same signature and are replaced at runtime in all places it is defined. Hidden methods are share the same signature but are only replaced in the subclasses for which they are defined.



From page 263
... hidden methods only replace parent methods in the calls defined in the child class.
...
Alternatively, at runtime the parent version of a hidden method is always executed if the call to the method is defined in the parent class.
 
Nurettin Armutcu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, which method will be called depends on the reference type. The following snippet will always invoke the (hidden) parent method, and the place where it is called is insignificant.

I don't understand the context to the place where a hidden method is called. Can someone give an example?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!