This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Field hiding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Field hiding" Watch "Field hiding" New topic
Author

Field hiding

Rahul Bhosale
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
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


RB
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Hiding as in encapsulation or in inheritance?


42
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18670
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 ]

"I'm not back." - Bill Harding, Twister
Rahul Bhosale
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Field hiding
 
Similar Threads
Kathy Sierra Chapter 2 Selftest Question 13
Why Java at all?
Inheritance Question
this.field
Validate if a field is present