What's the difference between abstraction and encapsulation?

前端 未结 24 1121
攒了一身酷
攒了一身酷 2020-12-22 17:16

In interviews I have been asked to explain the difference between abstraction and encapsulation. My answer has been along the lines of

  • Abstraction<

24条回答
  •  悲&欢浪女
    2020-12-22 17:47

    ABSTRACTION:"A view of a problem that extracts the essential information relevant to a particular purpose and ignores the remainder of the information."[IEEE, 1983]

    ENCAPSULATION: "Encapsulation or equivalently information hiding refers to the practice of including within an object everything it needs, and furthermore doing this in such a way that no other object need ever be aware of this internal structure."

提交回复
热议问题