Can anyone explain data encapsulation to me? Why is locking away variables important?

  • Dave Astels

    So that the use, and more importantly the modification, of them is controlled by the object that owns them. This avoids the situation where variables get changed out from under code that uses them by some other code. Encapsulation is a foundational concept of object oriented programming.

  • Dave Astels