What's the difference between abstraction and encapsulation?

前端 未结 24 1130
攒了一身酷
攒了一身酷 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 18:13

    A program has mainly two parts : DATA and PROCESS. abstraction hides data in process so that no one can change. Encapsulation hides data everywhere so that it cannot be displayed. I hope this clarifies your doubt.

提交回复
热议问题