| Author |
Is it not against OO concept?
|
Geethakrishna Srihari
Ranch Hand
Joined: May 25, 2005
Posts: 30
|
|
The following code compiles: class A { private int i; public void modifyOther(A a1) { a1.i = 20; } } The object has permission to use other object's private member ; it might be of same class - but is it not against OO? But this code compiles?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24040
|
|
|
Encapsulation in Java is class-based, not object based. C++ is the same way. Some languages -- Ruby, and Python, I think, too -- have object-based encapsulation. I don't think one is more object-oriented than the other, really.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Is it not against OO concept?
|
|
|