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进行设计,以使私有字段具有类级别的访问权限而不具有对象级别的访问权限?
jeck猫
相关分类