class Person
{
private BankAccount account;
Person(BankAccount account)
{
this.account = account;
}
public Person someMethod(Person person)
{
//Why accessing private field is possible?
BankAccount a = person.account;
}
}
请忘记设计。我知道 OOP 指定私有对象是类私有的。我的问题是,为什么 OOP 设计为私有字段具有类级访问权限而不是对象级访问权限?