If an object of a particular class, say class A, recieves an object of the same class as a parameter to one of its methods, how come the method is able to access the private members of the parameter object directly. E.g.,
class A{
int a;
void f(A a){
this.a = this.a + a.a;
}
}
Dont you consider this behaviour odd? I have tried and can verify that this works in
Java; its just that i didn't expect this work. i had expected to use a get method.
what your thoughts on this? any other oddities/unexpected behaviours that you noticed?