Is there a notion of object-private in any OOP language ?? I mean more restrictive than the classic private access ?
object-private : restricts the access to the object itself. Only methods objects that can access members and it will be impossible to write :
public class Person {
private String secret;
public String othersSecret;
public void snoop(Person p) {
othersSecret = p.secret; //will be prohibited by the compiler
}
EDIT :
If it exist can you give me some examples ... if not do you think it s interesting to have this kind of feature ?? and is it possible to simulate it in others OOP languages ??
EDIT 2 : Thanks you guys, all the answers were very instructive ...
Until now, the temporary conclusion :
The instance-private notion exists in 2 languages :
1 - Smalltalk after hours of googling :) I found the language behind this concept !!
2 - Ruby thanks to Logan :