Originally posted by Jagdish Shinde:
if((this.a==te.a)&&(this.c==te.c))
I thought i wont be able to access private variables a & c using te.a and this line would cause compilation error. But it is compiling with this line.
My question is, since a & c are private I would be restricted from using '.' operator to access a,c and a public getter was needed. but it is compiling fine.
Is this some special case!?
No, it's not a special case. Access modifiers work on the class level, not on the instance level. So, private members can be accessed from anywhere inside the same class, no matter what object they belong to.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus