Unexpected behavior when changing the modifier of a member variable in connection with an inner class
Lars Herschke
lhersch at dssgmbh.de
Tue May 5 14:43:27 UTC 2020
Hello,
there is a small test program in the appendix that I would like to know
about, bug or not.
The output of the program is the following for me.
main: set outer.x=1
main: set inner.x=2
main: set outer.y=1
main: set inner.y=2
work: out private x: outer.x=1, inner.x=2, non-qualified.x=1
work: out non-private y: outer.y=1, inner.y=2, non-qualified.y=2
work: set non-qualified.x=3
work: set non-qualified.y=3
main: out private x: outer.x=3, inner.x=2
main: out non-private y: outer.y=1, inner.y=3
Why does the interpretation of unqualified variables change here,
depending on the modifier.
Is this behavior desired and described somewhere or is it an error.
Thanks, Lars
More information about the discuss
mailing list