<p>书上说,实现类的封装能够实现: <br />一、隐藏类的实现细节。 <br />二、让使用者只能经过事先定制好的方法来访问数据,能够方便地加入控制逻辑,限制对属性的不合理操做。 <br />三、便于修改,加强代码的可维护性。 <br />四、可进行数据检查 </p> <p> </p> <p><a href="http://static.oschina.net/uploads/img/201405/27214244_2Cpz.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://static.oschina.net/uploads/img/201405/27214245_H5y3.png" width="733" height="372" /></a></p> <a href="http://static.oschina.net/uploads/img/201405/27214247_tBXx.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://static.oschina.net/uploads/img/201405/27214248_kK1A.png" width="730" height="346" /></a>.net