Can we access Private members of Super Class ?

Discussion in 'Object Oriented Concepts' started by vbraojava, Sep 11, 2008.

  1. vbraojava

    vbraojava New Member

    No, A SubClass does not inherit the Private Members of its SuperClass.

    But indirectly we can, how means see bellow :

    - If the SuperClass has public or protected methods for accessing its Private Fields, these we can also use in SubClass.

    - A Nested Class has access to all the Private Members (fields and methods) of its enclosing Class. Therefore, a public or protected Nested Class inherited by our SubClass has indirect access to all of the Private members of the SuperClass.
     
  2. anneroberts

    anneroberts Member

    Functionally, its not inherited. Yet ideally, it may be. An subclass doesn't inherit the private parts about its guardian population. However, On those superclass need government funded alternately ensured strategies to gaining entrance to its private fields, these could Additionally make utilized by the subclass.
     

Share This Page