KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is an interview question. Do subclasses inherit private fields? I answered "No", because we can't access them using the "normal OOP way". But the interviewer thinks that they are inherited, because we can access such fields indirectly or using reflection and they still exist in the object. After I came back, I found the following quote in the javadoc : Private Members in a Superclass A subclass does not inherit the private members of its parent class. Do you know any arguments for the interviewer's opinion?
Tags (comma-separated)
Save Edits
Cancel