View Single Post
  #2 (permalink)  
Old February 19th, 2008, 11:22 PM
jomet
Guest
 
Posts: n/a
Default

Quote:
quote:Originally posted by markhh



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. <s> If the setters and getters in the super class are defined as private the private instance variables in the sub class will be inaccessible."</s>

both are same
except some change in strike thorough part
read as 'the super class will be inaccessible'.

if private then variables will be inaccessible in sub class.
for accessing private variables we declare public getters and setters.
Usually by using public methods we will access private variables in sub class.

Cheers,

jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.
Reply With Quote