Tuesday, 5 February 2013

Encapsulation


  • The concept of encapsulation follows on where the discussion of abstraction left off
  • A typical object will encapsulate both it's attributes and behaviors
  • This not only means that the attributes and behaviors of the object are bound together into a capsule but also on an object can lock away its implementation detail from outside access
  • The object takes care of its inner working without outside interference
  • Imagine if people could easily mess around with the insides of a Microwave oven. It could easily be a recipe for disaster. Instead the inner working of the Microwave are encapsulated.

No comments:

Post a Comment