Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No. Private fields are not inherited... and that's why <em>Protected</em> was invented. It is by design. I guess this justified the existence of protected modifier.</p> <hr> <p>Now coming to the contexts. What you mean by inherited -- if it is there in the object created from derived class? yes, it is.</p> <p>If you mean can it be useful to derived class. Well, no.</p> <p>Now, when you come to functional programming <em>the private field of super class is not inherited in a meaningful way for the subclass</em>. For the subclass, a private field of super class is same as a private field of any other class.</p> <p><em>Functionally, it's not inherited. But <strong>ideally</strong>, it is.</em></p> <hr> <p>OK, just looked into Java tutorial they quote this:</p> <blockquote> <p><strong>Private Members in a Superclass</strong></p> <p>A subclass does not inherit the private members of its parent class. However, if the superclass has public or protected methods for accessing its private fields, these can also be used by the subclass. </p> </blockquote> <p>refer: <a href="http://download.oracle.com/javase/tutorial/java/IandI/subclasses.html" rel="nofollow">http://download.oracle.com/javase/tutorial/java/IandI/subclasses.html</a></p> <p>I agree, that the field is there. But, subclass does not get any privilege on that private field. To a subclass, the private field is same as any private field of any other class.</p> <p><em>I believe it's purely matter of point-of-view. You may mould the argument either side. It's better justify both way.</em></p> <p>&nbsp;</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload