Let's say we have a class foo
which has a private instance variable bar
.
Now let us have another class, baz
, which extends foo
. Can non-static methods in baz
access foo
's variable bar
if there is no accessor method defined in foo
?
I'm working in Java, by the way.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…