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

rules round up question.

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had some time and played the rules round up. One of the question has me puzzled. Hoping someone could provide me with an explanation. I don't have the exact wording but the gist

Given a Class (outer) with a private method and an inner class (inner). Can the inner class redefine behavior of the private method in the outer class.

Are they talking of something like... (if so why would you ever want to do this
 
gkumar kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Methods and varialbles of outer class can be accessed
directly by inner class.
But inner class variables and methods can't be accessed by outer class directly and
inorder to access, inner class should be instansiated in outer class then only inner class methods can be used.

So here we can define same function with 2 different
functionalities,just like overriding.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic