Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Field hiding

 
Rahul Bhosale
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody tell me what Field hiding is and how it is used in a real time application and why we need to use field hiding?
thanks
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiding as in encapsulation or in inheritance?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean hiding of fields: I would suggest it's almost never a good idea to do this intentionally, as it just creates confusion. However you may encounter it in programs written by others, or you may do it yourself without realizing it, so it's helpful to understand how it works.
[ March 19, 2005: Message edited by: Jim Yingst ]
 
Rahul Bhosale
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,
thanks for your response.


Hiding as in encapsulation or in inheritance?

Jeroen,
my question was in the context of inheritance. Can you explain field hiding in encapsulation?
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic