How to access the private variables of a class in its subclass?

Posted by giri on Stack Overflow See other posts from Stack Overflow or by giri
Published on 2010-02-13T20:18:27Z Indexed on 2010/04/09 17:53 UTC
Read the original article Hit count: 241

Filed under:
|
|

This is a question I was asked in an interview: I have class A with private members and Class B extends A. I know private members of a class cannot be accessed, but the question is: I need to access private members of class A from class B, rather than create variables with the same value in class B.

I hope I am clear with this question. Thanks.

© Stack Overflow or respective owner

Related posts about core

Related posts about java