the key to making encapsulation work is to have methods never directly access instance fields in a class other than their own. 
怎麼理解?

解决方案 »

  1.   

    封装的关键是拥有不使除自己之外的其它类直接访问实例变量的方法。就是说,本地实例声明为private或protected,定义操作这些实例的public方法,使得其它类只能通过这些public方法来访问本地实例。
      

  2.   

    to UnAgain() 
       我感覺,這樣翻譯還是有些別扭!
      

  3.   

    UnAgain() 的翻译和解释是比较准确的;
    封装,实际上就是类通过提供方法来访问数据成员,而不是直接访问数据成员;也就是说除了这些提供的方法能够直接访问数据成员,其它的都不能;
      

  4.   

    to:hero222(笑傲江湖) 
    呵呵,第一句直译。没办法,两边的语言习惯不一样。
    你是只想明白道理还是要翻译结果?
      

  5.   

    to to UnAgain()  && huyc_fly()
    thank you 
    明白了