A brilliant example of effective encapsulation through information hiding?

后端 未结 5 932
旧时难觅i
旧时难觅i 2021-02-04 12:13

\"Abstraction and encapsulation are complementary concepts: abstraction focuses on the observable behavior of an object... encapsulation fo

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 12:50

    What? You're not convinced yet?

    It's easier to show the opposite. We used to write code that had no control over who could access details of its implementation. That made it almost impossible at times to determine what code modified a variable.

    Also, you can't really abstract something if every piece of code in the world might possibly have depended on the implementation of specific concrete classes.

提交回复
热议问题