• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overriding final methods

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally methods declared as final cannot be overriden for security / design reasons.

But when a method declared as "private final" can be overriden in the child class. Do we get this behaviour since private members are not accessible in child ?
[ February 17, 2005: Message edited by: Srinivasa Raghavan ]
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Private methods in the parent class are not in inherited by the child classes. Hence, having methods of the same signature as well as being declared private & final does not equate to method overriding.

HTH
 
Kris Lightsey
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And it is not just a question of semantics. Overridden methods will show polymorphic behavior but redefining private methods with the same name and signature will not.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic