首先,我向你推荐
接近而不是
获得者/设置者
我的看法:
public class Person {
private string name;
public string Name {
get {
return this.name;
}
}
}
public class Department {
private int id;
private string name;
public int ID {
get {
return this.id;
}
}
public string Name {
get {
return this.name;
}
}
}
public class Employee : Person {
private Department department;
public Department Department {
get {
return this.department;
}
}
}
Employee.Name
返回在Person类中声明的雇员名称。