View Single Post
  #1 (permalink)  
Old February 19th, 2008, 06:01 AM
markhh markhh is offline
Authorized User
Points: 303, Level: 6
Points: 303, Level: 6 Points: 303, Level: 6 Points: 303, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: , , United Kingdom.
Posts: 71
Thanks: 23
Thanked 0 Times in 0 Posts
Default Access modifiers private and public

Hi all, if have been reading from 2 very good sources about using access modifiers (private, public etc). Both sources directly conflict with each other.

One says
"Under no circumstances will a sub class inherit any method or instance variable if it is defined as private in a super class"

and the other source says
"Any private instance variable that has been inherited from a super class can only be accessed indirectly through public setter and getter methods in the super class. If the setters and getters in the super class are defined as private the private instance variables in the sub class will be inaccessible."

Can anyone confirm which is correct.

Many Thanks
Mark