Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Private methods overridden?

 
Paul Salerno
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two different examples which indicate that it is legal to override a private method with one of less restrictions, of course the other statement indicates that this is illegal.
Case 1:

Case 2:
"A subclass of an object cannot access private variables or private methods of its own superclass." "Private methods of superclass not inherited by subclass or overridden by subclass." "The method in the subclass only shares the same name as the super method therefore the two methods have no relationship"
Again I do thank you for your help in advance.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer to the following thread posted yesterday about the same topic:
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=24&t=014945
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic