4.6 隐藏实施过程——访问控制



A primary consideration in object-oriented design is "separating the things that change from the things that stay the same."

每个库的用户(client programmer)必须能以来自己使用的库,并知道一旦新版本的库 推出,自己不需要改写代码。

为解决这个问题,Java推出了“访问指示符”的概念,允许库创建者声明哪些是客户 程序员可以是使用的,哪些是不可以使用的。


Next Page