摘要: 试想这么一个情况: 有一个Employee类, 这个类中含有一个部门(Department)属性, 并且Department是一种类. 如果我想知道某职工所在部门的经理人是谁的时候, 我需要通过 xxEmployee.Department.Manger来访问. 但这样做有个缺点是对于其它代码, Department是public的, 其它代码能够访问到Department里的其它特性. 可以在 Employee 类中写一个GetManger()方法进行封装, 在调用的时候只需要 xxEmployee.GetManger() 就行了... 阅读全文
posted @ 2011-05-11 15:49 Create Chen 阅读(2428) 评论(12) 推荐(5) 编辑