原先是class Person{
public string name;
public int age
}
public void main{
Person person=new person();
person.name("Mike");
person.age(30);
}
封装性之后
class Person{
private String name;
private int age;
get
set
}外部通过
public void main{
//对类实例化
Person person=new person();
person.getName();
person.getAge();
}